页面标签完成底座部署
This commit is contained in:
@@ -14,16 +14,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState, mapMutations} from "vuex";
|
||||
import {mapMutations, mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "AiNavTab",
|
||||
props: {
|
||||
routes: {default: () => []},
|
||||
fixed: {default: () => ({label: "首页", id: "/"})}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['apps', 'logs']),
|
||||
currentTab: v => v.isHome ? "/" : v.$route.fullPath,
|
||||
...mapState(['logs']),
|
||||
currentTab: v => v.isHome ? v.fixed.id : v.$route.fullPath,
|
||||
tabs: v => [{...v.fixed, fixed: 1}, v.logs.pages].flat(),
|
||||
isHome: v => v.fixed.id == v.$route.fullPath
|
||||
},
|
||||
@@ -36,7 +37,7 @@ export default {
|
||||
$route: {
|
||||
immediate: true,
|
||||
handler(v) {
|
||||
const currentPage = this.apps.find(e => e.name == v.name);
|
||||
const currentPage = this.routes.find(e => e.name == v.name);
|
||||
currentPage && this.addPage(currentPage)
|
||||
}
|
||||
}
|
||||
@@ -45,7 +46,7 @@ export default {
|
||||
...mapMutations(['addPage', 'deletePage']),
|
||||
handleTabClick(pageTab) {
|
||||
const {name} = pageTab
|
||||
this.$router.push(name)
|
||||
name != this.$route.fullPath && this.$router.push(name)
|
||||
},
|
||||
handleTabRemove(id) {
|
||||
const {pages} = this.logs
|
||||
|
||||
Reference in New Issue
Block a user