From 23eea905b84d1d41b9bfc5037efd77cf70da4825 Mon Sep 17 00:00:00 2001 From: big_sun_962464 Date: Thu, 4 Jul 2024 09:32:00 +0800 Subject: [PATCH] Thu Jul 4 09:32:00 CST 2024 inscode --- src/App.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 59552fc..1b97999 100644 --- a/src/App.vue +++ b/src/App.vue @@ -24,7 +24,12 @@ const obj={ name:'普通obj' } -const refMsg = ref("欢迎使用VUE3.0") +const refMsg = ref({ + msg:"欢迎使用VUE3.0" +}) +const shallowRefMsg = shallowRef({ + msg:"欢迎使用VUE3.1" +}) const refCom = ref({ name:'Com1', @@ -32,7 +37,14 @@ const refCom = ref({ }) function changeMsg(){ - refMsg.value = 777 + // refMsg.value = 777 + refMsg.value.msg = 888 +} + +function changeShallowRefMsg(){ + // shallowRefMsg.value = 888 + shallowRefMsg.value.msg = 999 + } function useFeature(id){ @@ -58,7 +70,9 @@ useFeature(refMsg)