uni-app v3 组件v-model,.sync 不支持么?
父组件:// msg = '123';
<view>
<l-code :value.sync="msg" />
<l-code v-model="msg" />
</view>
子组件:
<view class="l-code" @click="update_">
{{value}}
</view>
<script>
export default {
name: "l-code",
props: {
value: {
type: [String, Number],
default: '---',
},
},
methods: {
update_() {
this.$emit("update:value", 1)
this.$emit("input", 1)
},
}
}
</script>
6***@qq.com (作者)
那双向绑定用什么方法?
2023-09-06 17:58