Skip to content

Commit 0a672c1

Browse files
committed
feat(Loading): 新增开放函数
新增开放函数 linShow 和 linHide close #1342
1 parent 540b338 commit 0a672c1

File tree

1 file changed

+68
-6
lines changed

1 file changed

+68
-6
lines changed

src/loading/index.js

+68-6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ Component({
1414
type: String,
1515
value: '1'
1616
},
17-
bgColor: String,
18-
zIndex:{
19-
type:String,
17+
bgColor: {
18+
type: String,
19+
value: ""
20+
},
21+
zIndex: {
22+
type: String,
2023
value: '776'
2124
},
2225
// 类型
@@ -36,9 +39,15 @@ Component({
3639
value: 'medium',
3740
},
3841
// 自定义
39-
custom: Boolean,
42+
custom: {
43+
type: Boolean,
44+
value: false
45+
},
4046
// 全屏模式
41-
fullScreen: Boolean
47+
fullScreen: {
48+
type: Boolean,
49+
value: false
50+
}
4251
},
4352

4453
attached() {
@@ -55,15 +64,24 @@ Component({
5564
_init() {
5665
wx.lin = wx.lin || {};
5766
wx.lin.showLoading = (options) => {
67+
console.warn('wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html');
68+
if (!options) {
69+
options = {};
70+
}
71+
5872
const {
5973
custom = false,
6074
fullScreen = false,
6175
color = '',
6276
type = 'rotate',
6377
size = 'medium',
64-
opacity = '1'
78+
opacity = '1',
79+
bgColor = '',
80+
zIndex = '776',
6581
} = { ...options };
6682
this.setData({
83+
bgColor,
84+
zIndex,
6785
custom,
6886
fullScreen,
6987
color,
@@ -74,6 +92,7 @@ Component({
7492
});
7593
};
7694
wx.lin.hideLoading = () => {
95+
console.warn('wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html');
7796
this.setData({
7897
show: false
7998
});
@@ -83,5 +102,48 @@ Component({
83102
doNothingMove() {
84103
// do nothing……
85104
},
105+
106+
// ========== 开放函数 =============
107+
108+
/**
109+
* 显示 Loading
110+
* @param {*} options Loading 组件参数
111+
*/
112+
linShow(options) {
113+
if (!options) {
114+
options = {};
115+
}
116+
117+
const {
118+
custom = false,
119+
fullScreen = false,
120+
color = '',
121+
type = 'rotate',
122+
size = 'medium',
123+
opacity = '1',
124+
bgColor = '',
125+
zIndex = '776',
126+
} = { ...options };
127+
this.setData({
128+
bgColor,
129+
zIndex,
130+
custom,
131+
fullScreen,
132+
color,
133+
type,
134+
size,
135+
opacity,
136+
show: true
137+
});
138+
},
139+
140+
/**
141+
* 隐藏 Loading
142+
*/
143+
linHide() {
144+
this.setData({
145+
show: false
146+
})
147+
}
86148
}
87149
});

0 commit comments

Comments
 (0)