// components/spin/spin.ts Component({ /** * 组件的属性列表 */ properties: { spinning: { type: Boolean, value: false, observer(v) { if (!v && this.data.loading) { setTimeout(() => { this.setData({ complete: 'complete', }) }, 400) setTimeout(() => { this.setData({ loading: false, }) }, 600) } else { this.setData({ loading: true, complete: '', }) } }, }, }, /** * 组件的初始数据 */ data: { loading: false, complete: '', }, /** * 组件的方法列表 */ methods: {}, })