Commit 6aacc9d6 authored by 琉璃丶c's avatar 琉璃丶c

1.修改页面由于使用keepAlive导致 返回键问题

parent 1cb9ed90
...@@ -14,7 +14,8 @@ const myOrder = [ ...@@ -14,7 +14,8 @@ const myOrder = [
name: 'orderDetail', name: 'orderDetail',
meta: { meta: {
title: '订单详情', title: '订单详情',
auth: false auth: false,
keepAlive: true
}, },
component: resolve => require(['@/views/myOrder/detail/orderDetail'], resolve) component: resolve => require(['@/views/myOrder/detail/orderDetail'], resolve)
}, },
......
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
} }
} }
}, },
mounted() { activated() {
// 设置标题栏关闭返回按钮 // 设置标题栏关闭返回按钮
this.$store.commit('setNavBar', { this.$store.commit('setNavBar', {
show: true, show: true,
...@@ -102,12 +102,16 @@ export default { ...@@ -102,12 +102,16 @@ export default {
leftClick: this.onBrowserBack, leftClick: this.onBrowserBack,
rightClick: null rightClick: null
}) })
// 给window添加一个popstate事件,拦截返回键,执行this.onBrowserBack事件,addEventListener需要指向一个方法
window.addEventListener('popstate', this.onBrowserBack, false) window.addEventListener('popstate', this.onBrowserBack, false)
}, },
destroyed() { deactivated() {
// 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件 // 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
window.removeEventListener('popstate', this.onBrowserBack, false) window.removeEventListener('popstate', this.onBrowserBack, false)
}, },
mounted() {},
destroyed() {
},
methods: { methods: {
onBrowserBack() { onBrowserBack() {
this.$router.go(-1) this.$router.go(-1)
......
...@@ -76,7 +76,8 @@ export default { ...@@ -76,7 +76,8 @@ export default {
return time return time
} }
}, },
mounted() { activated() {
// let _this = this
// 设置标题栏关闭返回按钮 // 设置标题栏关闭返回按钮
this.$store.commit('setNavBar', { this.$store.commit('setNavBar', {
show: true, show: true,
...@@ -89,12 +90,16 @@ export default { ...@@ -89,12 +90,16 @@ export default {
}) })
// 给window添加一个popstate事件,拦截返回键,执行this.onBrowserBack事件,addEventListener需要指向一个方法 // 给window添加一个popstate事件,拦截返回键,执行this.onBrowserBack事件,addEventListener需要指向一个方法
window.addEventListener('popstate', this.onBrowserBack, false) window.addEventListener('popstate', this.onBrowserBack, false)
this.tabsTitleData()
}, },
destroyed() { deactivated() {
// 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件 // 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
window.removeEventListener('popstate', this.onBrowserBack, false) window.removeEventListener('popstate', this.onBrowserBack, false)
}, },
mounted() {
this.tabsTitleData()
},
destroyed() {
},
methods: { methods: {
// 单个发票点击事件 // 单个发票点击事件
orderItemAction(model) { orderItemAction(model) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment