代码如下:
复制弹框至登陆后的第一个页面
<div v-show="activity" class="activity">
<el-dialog v-model="activity" width="30%" center>
<img :src="userImage" alt="">
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click.once="closeactivity">点击领取</el-button>
</span>
</template>
</el-dialog>
</div>
js代码:
const activity = ref(false)
onMounted(() => {
console.log('onMounted: 页面1')
console.log('localStorage.getItem("thisactivity")',localStorage.getItem("thisactivity"))
let wu = localStorage.getItem("thisactivity")
if(wu == ''|| wu == null || wu == undefined){
activity.value = true;
localStorage.setItem("thisactivity",'更改后'+ '0');
}else {
activity.value = false;
}
})
以上便实现了登陆后弹框只弹一次,在引导应该也同样适用,预计下周尝试实现新用户导引