feat:keep-alive

master
ewall 5 years ago
parent cd551a1713
commit d005ff5282

@ -18,7 +18,7 @@ export default {
}, },
computed: { computed: {
key() { key() {
return this.$route.path return this.$route.fullPath
} }
} }
} }

@ -21,7 +21,10 @@ export default {
methods: { methods: {
onNavigate() { onNavigate() {
this.$router.push({ this.$router.push({
path: '/detail' path: '/detail',
query: {
t: +new Date()
}
}) })
} }
} }

@ -30,7 +30,10 @@ export default {
methods: { methods: {
onClick() { onClick() {
this.$router.push({ this.$router.push({
path: '/detail' path: '/detail',
query: {
t: +new Date()
}
}) })
} }
} }

@ -44,7 +44,10 @@ export default {
methods: { methods: {
onClick() { onClick() {
this.$router.push({ this.$router.push({
path: '/product' path: '/product',
query: {
t: +new Date()
}
}) })
} }
} }

@ -12,7 +12,8 @@ const routes = [
// webpackPreloadhttps://www.jianshu.com/p/bbdcfeee7fbc // webpackPreloadhttps://www.jianshu.com/p/bbdcfeee7fbc
component: () => import(/* webpackPreload: true */ '@/views/home'), component: () => import(/* webpackPreload: true */ '@/views/home'),
meta: { meta: {
showTab: true showTab: true,
keepAlive: true
} }
}, },
// 登录 // 登录
@ -49,13 +50,19 @@ const routes = [
{ {
path: '/product', path: '/product',
name: 'Product', name: 'Product',
component: () => import('@/views/product') component: () => import('@/views/product'),
meta: {
keepAlive: true
}
}, },
// 商品详情 // 商品详情
{ {
path: '/detail', path: '/detail',
name: 'Detail', name: 'Detail',
component: () => import('@/views/detail') component: () => import('@/views/detail'),
meta: {
keepAlive: true
}
}, },
// 地址管理 // 地址管理
{ {

Loading…
Cancel
Save