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.

61 lines
1.1 KiB

const STORAGE_KEY = 'PLUG-ADD-MYAPP-KEY';
Component({
properties: {
text: {
type: String,
value: '点击「添加小程序」,下次访问更便捷'
},
duration: {
type: Number,
value: 3
}
},
data: {
SHOW:false,
SHOW_TOP: true,
SHOW_MODAL: false,
statusBarHeight:20,
attachDir:global.config.attachDir
},
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,
});
}
}
})