fix: 解决不同route映射同组件时不刷新的问题
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="cn-container">
|
<div class="cn-container">
|
||||||
<router-view/>
|
<router-view :key="routerKey"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -10,6 +10,11 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
routerKey () {
|
||||||
|
return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>{{panel.name}}</div>
|
<div>{{panel}}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -15,7 +15,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
this.panel = (await getPanelList({ type: this.panelType }))[0]
|
const panels = await getPanelList({ type: this.panelType })
|
||||||
|
if (panels && panels.length > 0) {
|
||||||
|
this.panel = panels[0]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
// 取得panel的type
|
// 取得panel的type
|
||||||
|
|||||||
Reference in New Issue
Block a user