You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.0 KiB

const STORAGE_KEY = 'PLUG-ADD-MYAPP-KEY';
Component({
properties: {
text: {
type: String,
value: '点击「添加小程序」,下次访问更便捷'
},
duration: {
type: Number,
value: 3000
}
},
data: {
SHOW:false,
SHOW_TOP: true,
SHOW_MODAL: false,
statusBarHeight:20
},
ready: function () {
let cache = wx.getStorageSync(STORAGE_KEY);
if (cache) return;
this.setData({
SHOW:true
});
setTimeout(() => {
this.setData({
SHOW_TOP: false
})
}, this.data.duration * 1000);
},
attached(){
wx.getSystemInfo({
success: res=> {
let {statusBarHeight} = res;
this.setData({statusBarHeight});
}
})
},
methods: {
showModal: function () {
this.setData({
SHOW_TOP: false,
SHOW_MODAL: true
});
},
okHandler: function () {
this.setData({
SHOW: false
});
wx.setStorage({
key: STORAGE_KEY,
data: +new Date,
});
}
}
})