第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

求問(wèn)我該如何使用v-model組件?

求問(wèn)我該如何使用v-model組件?

寶慕林4294392 2021-06-20 17:13:02
v-model在組件中的使用我感覺(jué)就是一個(gè)傳值的過(guò)程,vue在傳值過(guò)程中方式也還是比較多的,像是event或者props等,但是不太熟悉v-model在組件中應(yīng)該如何使用。
查看完整描述

1 回答

?
莫回?zé)o

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊

v-model在組件中如何使用。
實(shí)現(xiàn)點(diǎn)擊回應(yīng)后,父親對(duì)兒子說(shuō)的話(huà)變成了兒子的回應(yīng)。兒子收到的信息也變了,實(shí)現(xiàn)通信。

<!-- 父組件 --> <template> <p class="parent"> <p>我是父親, 對(duì)兒子說(shuō): {{sthGiveChild}}</p> <Child v-model="sthGiveChild"></Child> </p> </template> <script> import Child from './Child.vue'; export default { data() { return { sthGiveChild: '給你100塊' }; }, components: { Child } } </script>

<!-- 子組件 --> <template> <p class="child"> <p>我是兒子,父親對(duì)我說(shuō): {{give}}</p> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" @click="returnBackFn">回應(yīng)</a> </p> </template> <script> export default { props: { give: String }, model: { prop: 'give', event: 'returnBack' }, methods: { returnBackFn() { this.$emit('returnBack', '還你200塊'); } } } </script>

默認(rèn)情況下,一個(gè)組件上的 v-model 會(huì)把 value 用作 prop 且把 input 用作 event。

查看完整回答
反對(duì) 回復(fù) 2021-06-26
  • 1 回答
  • 0 關(guān)注
  • 660 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)