<script lang="ts">
import { defineComponent, onMounted, toRefs, reactive, computed, watch } from 'vue'
import { useRouter } from 'vue-router'
export default defineComponent({
name: 'Tab',
setup () {
const data = reactive({
activeName: '',
})
watch(() => Router.currentRoute.value.path, (toPath) => {
// 要执行的方法
// console.log(toPath, 'toPath')
if (toPath == `/dashboard/saleschannel/microstores/${data.storeNo}/logo`) {
data.activeName = 'Logo'
}
}, { immediate: true, deep: true })
return {
...toRefs(data),
}
}
})
</script>
Vue3,watch监视路由2022/6/23pm
最新推荐文章于 2024-10-12 16:17:00 发布