|
@@ -5,7 +5,7 @@
|
|
|
:key="index"
|
|
:key="index"
|
|
|
role="presentation"
|
|
role="presentation"
|
|
|
:class="{ active: currentTabIndex === index }"
|
|
:class="{ active: currentTabIndex === index }"
|
|
|
- @click="changeTab(index,item)"
|
|
|
|
|
|
|
+ @click="changeTab(index, item)"
|
|
|
>
|
|
>
|
|
|
<a>{{ item.groupName }}</a>
|
|
<a>{{ item.groupName }}</a>
|
|
|
<span :class="{ jt: true, active: currentTabIndex === index }" />
|
|
<span :class="{ jt: true, active: currentTabIndex === index }" />
|
|
@@ -21,7 +21,8 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, defineEmits, defineProps, watch } from 'vue';
|
|
import { ref, defineEmits, defineProps, watch } from 'vue';
|
|
|
-
|
|
|
|
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
|
|
+const router = useRoute();
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
tabProps: {
|
|
tabProps: {
|
|
|
type: Array,
|
|
type: Array,
|
|
@@ -32,12 +33,19 @@ const props = defineProps({
|
|
|
const emits = defineEmits(['getNowTab']);
|
|
const emits = defineEmits(['getNowTab']);
|
|
|
|
|
|
|
|
const currentTabIndex = ref(0);
|
|
const currentTabIndex = ref(0);
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => router.fullPath,
|
|
|
|
|
+ (newPath, oldPath) => {
|
|
|
|
|
+ if (newPath !== oldPath) {
|
|
|
|
|
+ currentTabIndex.value = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+);
|
|
|
|
|
|
|
|
-const changeTab = (index,record) => {
|
|
|
|
|
|
|
+const changeTab = (index, record) => {
|
|
|
currentTabIndex.value = index;
|
|
currentTabIndex.value = index;
|
|
|
emits('getNowTab', record.groupName);
|
|
emits('getNowTab', record.groupName);
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|