Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 68 additions & 6 deletions src/loading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ Component({
type: String,
value: '1'
},
bgColor: String,
zIndex:{
type:String,
bgColor: {
type: String,
value: ''
},
zIndex: {
type: String,
value: '776'
},
// 类型
Expand All @@ -36,9 +39,15 @@ Component({
value: 'medium',
},
// 自定义
custom: Boolean,
custom: {
type: Boolean,
value: false
},
// 全屏模式
fullScreen: Boolean
fullScreen: {
type: Boolean,
value: false
}
},

attached() {
Expand All @@ -55,15 +64,24 @@ Component({
_init() {
wx.lin = wx.lin || {};
wx.lin.showLoading = (options) => {
console.warn('wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html');
if (!options) {
options = {};
}

const {
custom = false,
fullScreen = false,
color = '',
type = 'rotate',
size = 'medium',
opacity = '1'
opacity = '1',
bgColor = '',
zIndex = '776',
} = { ...options };
this.setData({
bgColor,
zIndex,
custom,
fullScreen,
color,
Expand All @@ -74,6 +92,7 @@ Component({
});
};
wx.lin.hideLoading = () => {
console.warn('wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html');
this.setData({
show: false
});
Expand All @@ -83,5 +102,48 @@ Component({
doNothingMove() {
// do nothing……
},

// ========== 开放函数 =============

/**
* 显示 Loading
* @param {*} options Loading 组件参数
*/
linShow(options) {
if (!options) {
options = {};
}

const {
custom = false,
fullScreen = false,
color = '',
type = 'rotate',
size = 'medium',
opacity = '1',
bgColor = '',
zIndex = '776',
} = { ...options };
this.setData({
bgColor,
zIndex,
custom,
fullScreen,
color,
type,
size,
opacity,
show: true
});
},

/**
* 隐藏 Loading
*/
linHide() {
this.setData({
show: false
});
}
}
});