提交 23eea905 编写于 作者: B big_sun_962464

Thu Jul 4 09:32:00 CST 2024 inscode

上级 42952c97
...@@ -24,7 +24,12 @@ const obj={ ...@@ -24,7 +24,12 @@ const obj={
name:'普通obj' name:'普通obj'
} }
const refMsg = ref("欢迎使用VUE3.0") const refMsg = ref({
msg:"欢迎使用VUE3.0"
})
const shallowRefMsg = shallowRef({
msg:"欢迎使用VUE3.1"
})
const refCom = ref({ const refCom = ref({
name:'Com1', name:'Com1',
...@@ -32,7 +37,14 @@ const refCom = ref({ ...@@ -32,7 +37,14 @@ const refCom = ref({
}) })
function changeMsg(){ function changeMsg(){
refMsg.value = 777 // refMsg.value = 777
refMsg.value.msg = 888
}
function changeShallowRefMsg(){
// shallowRefMsg.value = 888
shallowRefMsg.value.msg = 999
} }
function useFeature(id){ function useFeature(id){
...@@ -58,7 +70,9 @@ useFeature(refMsg) ...@@ -58,7 +70,9 @@ useFeature(refMsg)
<template> <template>
<p>{{ refMsg }}</p> <p>{{ refMsg }}</p>
<button @click="changeMsg">++</button> <button @click="changeMsg">changeMsg</button>
<p>{{ shallowRefMsg }}</p>
<button @click="changeShallowRefMsg">shallowRefMsg</button>
<p> <p>
<button @click="changeCom">+-</button> <button @click="changeCom">+-</button>
</p> </p>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册