53 lines
924 B
JavaScript
53 lines
924 B
JavaScript
// 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
|
|
})
|
|
}
|
|
},
|
|
}
|
|
})
|