uni.getStorage({
key: "popUp-show-time",
success: (res) => {
if (!res.data || new Date().getTime() - res.data > 1000 * 60*60*24) {
uni.setStorage({
key: "popUp-show-time",
data: new Date().getTime(),
});
this.show_index_big_pic = true;
}
},
fail: (err) => {
this.show_index_big_pic = true;
},
});
data 定义一个判断变量show_index_big_pic ,默认为false,在onLoad里面判断缓存的key是否在有效期内,如果在,则不弹出,反之弹出即可