vue子元件改變父元件值--寫法1
阿新 • • 發佈:2021-07-07
1、父:要點
- 正常父傳子
:msg="oldValue" - 正常子接父
@iClick="yClick"
<template> |
2、子:要點
- 在data中將接收到的props值重新賦值
childMsg: this.msg - 將v-model拆分
:value="childMsg" @input="changeMsg"
- 正常子傳父
this.$emit('iClick', this.childMsg)
<template> |