first commit
This commit is contained in:
52
衣莎项目/源码/YiShaXiYi/component/loading-prog/loading-prog.js
Normal file
52
衣莎项目/源码/YiShaXiYi/component/loading-prog/loading-prog.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// component/loading-prog/loading-prog.js
|
||||
const app = getApp();
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
isLoading: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
loadProgress: 0,
|
||||
system: app.globalData.system, //设备相关信息
|
||||
},
|
||||
/**
|
||||
* 在组件实例刚刚被创建时执行
|
||||
*/
|
||||
created() {
|
||||
this.loadProgress()
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
// 加载动画
|
||||
loadProgress() {
|
||||
this.setData({
|
||||
loadProgress: this.data.loadProgress + 3
|
||||
})
|
||||
if (this.data.loadProgress < 100) {
|
||||
setTimeout(() => {
|
||||
this.loadProgress();
|
||||
}, 70)
|
||||
} else {
|
||||
this.setData({
|
||||
loadProgress: 0
|
||||
})
|
||||
}
|
||||
if (!this.properties.isLoading) {
|
||||
this.setData({
|
||||
loadProgress: 100
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user