刷新方法和重定向方法升级

Former-commit-id: 585670458831c80f57d20e9283fb82476b946e27 [formerly eb7045546e2bd98ba5b5c5e7578c56588b2e3a1d] [formerly 585670458831c80f57d20e9283fb82476b946e27 [formerly eb7045546e2bd98ba5b5c5e7578c56588b2e3a1d] [formerly 585670458831c80f57d20e9283fb82476b946e27 [formerly eb7045546e2bd98ba5b5c5e7578c56588b2e3a1d] [formerly eb7045546e2bd98ba5b5c5e7578c56588b2e3a1d [formerly ce225a2891d4ce5ff086775b9b486bdbf8ee3e86 [formerly 1808e7dd59762f0a4c7e0aceb66ca2e6212d1ca1]]]]]
Former-commit-id: 9845611172f6adb3ed6fdb713d72f23a9dd49f00
Former-commit-id: 9f6810a3f586a57ebb79a19924357771d41b9bbf
Former-commit-id: 371348953967cfe88c0b2dce944e521a5c95b835 [formerly c7863b7e22f5ab553a97b828da52fbbcc6f73381]
Former-commit-id: 58b6d3a88b0f06cb5813bfe913ba113f8bd9d703
Former-commit-id: cdaef260dbddecc1848dbbe5fd75a070d305e1e5
Former-commit-id: 1a1369bb32c9b8599ee8688da2d0dbbeab4b06e2
Former-commit-id: 69be53f5764c10f665dc29fb9f3ac54f71ea639c
Former-commit-id: 6883200052e680c1478e801401fe0d014ebf696c
This commit is contained in:
liyang
2018-11-05 23:13:28 +08:00
parent 8d4f883026
commit 22b6003da1
6 changed files with 83 additions and 20 deletions

View File

@@ -6,3 +6,11 @@
<el-button type="primary" @click="$router.push({ name: 'demo-playground-page-argu-send' })">返回发送数据的页面</el-button>
</d2-container>
</template>
<script>
export default {
mounted () {
console.log('this.$route', this.$route)
}
}
</script>

View File

@@ -1,16 +1,42 @@
<template>
<d2-container type="card">
<!-- 证明有缓存 -->
<p class="d2-mt-0">在下面的输入框输入任意字符后切换到其它页面再回到此页时输入框文字保留证明被缓存</p>
<el-input v-model="value" placeholder="input here"></el-input>
<!-- 页签操作 -->
<p>页签操作</p>
<el-button @click="closeCurrent" type="danger">
<d2-icon name="times"/>
关闭当前页
</el-button>
<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>
</d2-container>
</template>
<script>
import { mapActions } from 'vuex'
import { mapMutations, mapActions } from 'vuex'
export default {
name: 'demo-playground-store-page',
data () {
return {
value: ''
}
},
methods: {
...mapMutations('d2admin/page', [
'keepAliveRemove',
'keepAliveClean'
]),
...mapActions('d2admin/page', [
'close'
]),
@@ -20,6 +46,26 @@ export default {
tagName: this.$route.name,
vm: this
})
},
// 刷新当前页面
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)
}
}
}