fix: 增加返回按钮

This commit is contained in:
zhangds 2024-05-07 18:23:42 +08:00
parent b03f586bf0
commit 967361aa8c
1 changed files with 6 additions and 8 deletions

View File

@ -18,7 +18,7 @@
<body> <body>
<div id="ysf"> <div id="ysf">
<!-- <img @click="backGoodsFn" v-if="backAble&&!isMini" class="backIcon" <!-- <img @click="backGoodsFn" v-if="!isMini" class="backIcon"
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt=""> --> src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png" alt=""> -->
<div class="prompt" :class="promptShow?'proactive':''"> <div class="prompt" :class="promptShow?'proactive':''">
{{prompt_text}} {{prompt_text}}
@ -148,6 +148,10 @@
} }
}, },
mounted() { mounted() {
window.addEventListener('popstate', function (event) {
history.go(-2); // 监听返回按钮 直接关闭按钮
});
document.title = localStorage.getItem('title'); document.title = localStorage.getItem('title');
/* 判断是否是微信小程序内 */ /* 判断是否是微信小程序内 */
let ua = window.navigator.userAgent.toLowerCase(); let ua = window.navigator.userAgent.toLowerCase();
@ -248,13 +252,7 @@
backGoodsFn() { backGoodsFn() {
/* 判断是否web-view打开 则不返回 */ /* 判断是否web-view打开 则不返回 */
if (this.isMini) return; if (this.isMini) return;
if (this.backAble) { history.go(-2);
setTimeout(() => {
window.location.replace('./homepage.html');
}, 300);
} else {
history.go(-2);
}
}, },
/* 触发提示 */ /* 触发提示 */