From 969725647117eb7ca148b2e8cfa9ec8b5eb432fa Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 22 十月 2024 11:04:10 +0800 Subject: [PATCH] 工艺缓存优化 --- src/views/demo/feat/tab-params/index.vue | 29 +++++++++++++---------------- 1 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/views/demo/feat/tab-params/index.vue b/src/views/demo/feat/tab-params/index.vue index c2e06fe..84cebf8 100644 --- a/src/views/demo/feat/tab-params/index.vue +++ b/src/views/demo/feat/tab-params/index.vue @@ -1,27 +1,24 @@ <template> <PageWrapper title="甯﹀弬鏁版爣绛鹃〉" content="鏀寔甯﹀弬鏁板tab缂撳瓨"> - Current Param : {{ params }} + Current Param : {{ computedParams }} <br /> Keep Alive <Input /> </PageWrapper> </template> -<script lang="ts"> - import { computed, defineComponent, unref } from 'vue'; - import { useRouter } from 'vue-router'; - import { PageWrapper } from '/@/components/Page'; - import { Input } from 'ant-design-vue'; - export default defineComponent({ +<script lang="ts" setup> + import { computed, unref } from 'vue'; + import { useRouter } from 'vue-router'; + + import { Input } from 'ant-design-vue'; + import { PageWrapper } from '@/components/Page'; + + const { currentRoute } = useRouter(); + + defineOptions({ name: 'TestTab', - components: { PageWrapper, Input }, - setup() { - const { currentRoute } = useRouter(); - return { - params: computed(() => { - return unref(currentRoute).params; - }), - }; - }, }); + + const computedParams = computed(() => unref(currentRoute).params); </script> -- Gitblit v1.9.3