From ebbd788fbb2c0b45d4473798efc57eec8ba74a25 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 18 六月 2024 14:51:16 +0800 Subject: [PATCH] 版本更新至2.11.5 --- src/views/demo/feat/menu-params/index.vue | 41 +++++++++++++++-------------------------- 1 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/views/demo/feat/menu-params/index.vue b/src/views/demo/feat/menu-params/index.vue index 1a566b2..ffa89c2 100644 --- a/src/views/demo/feat/menu-params/index.vue +++ b/src/views/demo/feat/menu-params/index.vue @@ -1,10 +1,10 @@ <template> <PageWrapper title="甯﹀弬鏁拌彍鍗曪紙璺敱锛�" content="鏀寔澶氱骇鍙傛暟"> - 褰撳墠鍙傛暟锛歿{ params }} + 褰撳墠鍙傛暟锛歿{ computedParams }} <br /> 杈撳叆鍙傛暟鍒囨崲璺敱锛� - <Input v-model:value="value" placeholder="寤鸿涓簎rl鏍囧噯瀛楃锛岃緭鍏ュ悗鐐瑰嚮鍒囨崲" /> - <a-button type="primary" @click="handleClickGo">鍒囨崲璺敱</a-button> + <a-input v-model:value="value" placeholder="寤鸿涓簎rl鏍囧噯瀛楃锛岃緭鍏ュ悗鐐瑰嚮鍒囨崲" /> + <a-button type="primary" class="my-2" @click="handleClickGo">鍒囨崲璺敱</a-button> <br /> 鍒囨崲璺敱鍚� <ul> @@ -13,30 +13,19 @@ </ul> </PageWrapper> </template> -<script lang="ts"> - import { Input } from 'ant-design-vue'; - import { computed, defineComponent, ref, unref } from 'vue'; +<script lang="ts" setup> import { useRouter } from 'vue-router'; - import { PageWrapper } from '/@/components/Page'; + import { computed, ref, unref } from 'vue'; + import { PageWrapper } from '@/components/Page'; - export default defineComponent({ - name: 'TestMenu', - components: { PageWrapper, Input }, - setup() { - const { currentRoute, replace } = useRouter(); - const value = ref<string>(''); + const value = ref(''); - const handleClickGo = () => { - const { name } = unref(currentRoute); - replace({ name: name!, params: { id: unref(value) } }); - }; - return { - value, - handleClickGo, - params: computed(() => { - return unref(currentRoute).params; - }), - }; - }, - }); + const { currentRoute, replace } = useRouter(); + + const computedParams = computed(() => unref(currentRoute).params); + + const handleClickGo = () => { + const { name } = unref(currentRoute); + replace({ name: name!, params: { id: unref(value) } }); + }; </script> -- Gitblit v1.9.3