Vue2 修饰符 sync

修饰符

修饰符可以简化代码

事件修饰符

在事件处理程序中调用 event.preventDefault() 或 event.stopPropagation() 是非常常见的需求。

.stop 阻止事件继续传播
.prevent
.capture 用事件捕获模式
.self 只当在 event.target 是当前元素自身时触发处理函数
.once 事件将只会触发一次
.passive

内容很多···

.sync

<my-component :foo.sync="bar"></my-component>

等价于

<my-component :foo="bar" @update:foo="value => bar = value"></my-component>
posted @ 2021-09-06 13:42  海胆Sur  阅读(23)  评论(0)    收藏  举报  来源