2018-11-03 22:03:21 +08:00
|
|
|
|
<template>
|
2018-11-17 11:16:07 +08:00
|
|
|
|
<d2-container :filename="filename" 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>
|
|
|
|
|
|
<!-- 页签操作 -->
|
2018-11-06 22:33:09 +08:00
|
|
|
|
<p>关闭标签页</p>
|
|
|
|
|
|
<el-button-group>
|
|
|
|
|
|
<el-button @click="handleCloseCurrent">
|
|
|
|
|
|
<d2-icon name="times"/> 当前
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button @click="handleCloseLeft">
|
|
|
|
|
|
<d2-icon name="arrow-left"/> 左侧
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button @click="handleCloseRight">
|
|
|
|
|
|
右侧 <d2-icon name="arrow-right"/>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button @click="handleCloseOther">
|
|
|
|
|
|
其它 <d2-icon name="times"/>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button @click="handleCloseAll">
|
|
|
|
|
|
全部 <d2-icon name="times-circle"/>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</el-button-group>
|
2018-11-05 23:13:28 +08:00
|
|
|
|
<p>刷新</p>
|
|
|
|
|
|
<el-button-group>
|
2018-11-06 22:33:09 +08:00
|
|
|
|
<el-button @click="handleCleanCacheAndRefreshCurrent">
|
2018-11-05 23:13:28 +08:00
|
|
|
|
<d2-icon name="refresh"/>
|
|
|
|
|
|
清空当前页缓存并刷新
|
|
|
|
|
|
</el-button>
|
2018-11-06 22:33:09 +08:00
|
|
|
|
<el-button @click="handleCleanCacheAndRefreshAll">
|
2018-11-05 23:13:28 +08:00
|
|
|
|
<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 {
|
2018-11-17 11:54:57 +08:00
|
|
|
|
filename: __filename,
|
2018-11-05 23:13:28 +08:00
|
|
|
|
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', [
|
2018-11-06 22:33:09 +08:00
|
|
|
|
'close',
|
|
|
|
|
|
'closeLeft',
|
|
|
|
|
|
'closeRight',
|
|
|
|
|
|
'closeOther',
|
|
|
|
|
|
'closeAll'
|
2018-11-03 22:03:21 +08:00
|
|
|
|
]),
|
2018-11-06 22:33:09 +08:00
|
|
|
|
// 关闭当前
|
|
|
|
|
|
handleCloseCurrent () {
|
2018-11-03 22:03:21 +08:00
|
|
|
|
this.close({
|
2018-11-28 16:49:46 +08:00
|
|
|
|
tagName: this.$route.fullPath,
|
2018-11-03 22:03:21 +08:00
|
|
|
|
vm: this
|
|
|
|
|
|
})
|
2018-11-05 23:13:28 +08:00
|
|
|
|
},
|
2018-11-06 22:33:09 +08:00
|
|
|
|
// 关闭左侧
|
|
|
|
|
|
handleCloseLeft () {
|
|
|
|
|
|
this.closeLeft({
|
2018-11-28 16:49:46 +08:00
|
|
|
|
tagName: this.$route.fullPath,
|
2018-11-06 22:33:09 +08:00
|
|
|
|
vm: this
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 关闭右侧
|
|
|
|
|
|
handleCloseRight () {
|
|
|
|
|
|
this.closeRight({
|
2018-11-28 16:49:46 +08:00
|
|
|
|
tagName: this.$route.fullPath,
|
2018-11-06 22:33:09 +08:00
|
|
|
|
vm: this
|
2018-11-05 23:13:28 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2018-11-06 22:33:09 +08:00
|
|
|
|
// 关闭其他
|
|
|
|
|
|
handleCloseOther () {
|
|
|
|
|
|
this.closeOther({
|
2018-11-28 16:49:46 +08:00
|
|
|
|
tagName: this.$route.fullPath,
|
2018-11-06 22:33:09 +08:00
|
|
|
|
vm: this
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 关闭全部
|
|
|
|
|
|
handleCloseAll () {
|
|
|
|
|
|
this.closeAll(this)
|
|
|
|
|
|
},
|
2018-11-05 23:13:28 +08:00
|
|
|
|
// 清空当前页缓存并刷新此页面
|
2018-11-06 22:33:09 +08:00
|
|
|
|
handleCleanCacheAndRefreshCurrent () {
|
2018-11-28 16:49:46 +08:00
|
|
|
|
this.keepAliveRemove(this.$route.fullPath)
|
2018-11-06 22:33:09 +08:00
|
|
|
|
this.$nextTick(this.$router.replace('/refresh'))
|
2018-11-05 23:13:28 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 清空所有的缓存并刷新此页面
|
2018-11-06 22:33:09 +08:00
|
|
|
|
handleCleanCacheAndRefreshAll () {
|
2018-11-05 23:13:28 +08:00
|
|
|
|
this.keepAliveClean()
|
2018-11-06 22:33:09 +08:00
|
|
|
|
this.$nextTick(this.$router.replace('/refresh'))
|
2018-11-03 22:03:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|