diff --git a/src/App.vue b/src/App.vue index 59552fce0a090890328f4ba00f19acf9a5030bc4..1b979998e98f72cd44a49e223d6dd1967d7aaab7 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)