2018-11-03 22:03:21 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<d2-container type="card">
|
2018-11-05 23:13:28 +08:00
|
|
|
|
<!-- 证明有缓存 -->
|
|
|
|
|
|
<p class="d2-mt-0">在下面的输入框输入任意字符后,切换到其它页面,再回到此页时输入框文字保留,证明被缓存</p>
|
|
|
|
|
|
<el-input v-model="value" placeholder="input here"></el-input>
|
|
|
|
|
|
<!-- 页签操作 -->
|
|
|
|
|
|
<p>页签操作</p>
|
2018-11-03 22:03:21 +08:00
|
|
|
|
<el-button @click="closeCurrent" type="danger">
|
|
|
|
|
|
<d2-icon name="times"/>
|
|
|
|
|
|
关闭当前页
|
|
|
|
|
|
</el-button>
|
2018-11-05 23:13:28 +08:00
|
|
|
|
<p>刷新</p>
|
|
|
|
|
|
<el-button-group>
|
|
|
|
|
|
<el-button @click="cleanCacheAndRefreshCurrent">
|
|
|
|
|
|
<d2-icon name="refresh"/>
|
|
|
|
|
|
清空当前页缓存并刷新
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button @click="cleanCacheAndRefreshAll">
|
|
|
|
|
|
<d2-icon name="refresh"/>
|
|
|
|
|
|
清空所有缓存并刷新
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</el-button-group>
|
2018-11-03 22:03:21 +08:00
|
|
|
|
</d2-container>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2018-11-05 23:13:28 +08:00
|
|
|
|
import { mapMutations, mapActions } from 'vuex'
|
2018-11-03 22:03:21 +08:00
|
|
|
|
export default {
|
2018-11-05 23:13:28 +08:00
|
|
|
|
name: 'demo-playground-store-page',
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2018-11-03 22:03:21 +08:00
|
|
|
|
methods: {
|
2018-11-05 23:13:28 +08:00
|
|
|
|
...mapMutations('d2admin/page', [
|
|
|
|
|
|
'keepAliveRemove',
|
|
|
|
|
|
'keepAliveClean'
|
|
|
|
|
|
]),
|
2018-11-03 22:03:21 +08:00
|
|
|
|
...mapActions('d2admin/page', [
|
|
|
|
|
|
'close'
|
|
|
|
|
|
]),
|
|
|
|
|
|
// 关闭当前页
|
|
|
|
|
|
closeCurrent () {
|
|
|
|
|
|
this.close({
|
|
|
|
|
|
tagName: this.$route.name,
|
|
|
|
|
|
vm: this
|
|
|
|
|
|
})
|
2018-11-05 23:13:28 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 刷新当前页面
|
|
|
|
|
|
refreshCurrent () {
|
|
|
|
|
|
// const { path, query } = this.$route
|
|
|
|
|
|
// this.$router.replace({
|
|
|
|
|
|
// path: '/redirect/' + JSON.stringify({ path, query })
|
|
|
|
|
|
// })
|
|
|
|
|
|
this.$router.replace({
|
|
|
|
|
|
path: '/refresh'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 清空当前页缓存并刷新此页面
|
|
|
|
|
|
cleanCacheAndRefreshCurrent () {
|
|
|
|
|
|
this.keepAliveRemove(this.$route.name)
|
|
|
|
|
|
this.$nextTick(this.refreshCurrent)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 清空所有的缓存并刷新此页面
|
|
|
|
|
|
cleanCacheAndRefreshAll () {
|
|
|
|
|
|
this.keepAliveClean()
|
|
|
|
|
|
this.$nextTick(this.refreshCurrent)
|
2018-11-03 22:03:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|