mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-03 13:44:47 +08:00
feat: tabs operation view
This commit is contained in:
@@ -1,10 +1,50 @@
|
||||
<script setup lang="ts"></script>
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const activeName = ref("tag");
|
||||
|
||||
function toDetail(index: number) {
|
||||
useMultiTagsStoreHook().handleTags("push", {
|
||||
path: `/tabs/detail/${index}`,
|
||||
parentPath: route.matched[0].path,
|
||||
name: "tabDetail",
|
||||
meta: {
|
||||
title: `No.${index} - 详情信息`,
|
||||
showLink: false,
|
||||
i18n: false,
|
||||
dynamicLevel: 3,
|
||||
realPath: "/tabs/detail"
|
||||
}
|
||||
});
|
||||
router.push(`/tabs/detail/${index}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tabs-container">111</div>
|
||||
<el-collapse v-model="activeName" class="tabs-container">
|
||||
<el-collapse-item
|
||||
title="标签页复用超出限制自动关闭(使用场景: 动态路由)"
|
||||
name="tag"
|
||||
>
|
||||
<el-button
|
||||
v-for="index in 6"
|
||||
:key="index"
|
||||
size="medium"
|
||||
@click="toDetail(index)"
|
||||
>
|
||||
打开{{ index }}详情页
|
||||
</el-button>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// .tabs-container {
|
||||
// }
|
||||
.tabs-container {
|
||||
padding: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
11
src/views/tabs/tabDetail.vue
Normal file
11
src/views/tabs/tabDetail.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from "vue-router";
|
||||
const route = useRoute();
|
||||
const index = route.params?.id ?? -1;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>{{ index }} - 详情页内容在此</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user