vue2迁移到vue3,v-model的调整
项目从vue2迁移到vue3,v-model不能再使用了,需要如何调整?
(图片来源网络,侵删)
下面只提示变化最小的迁移,不赘述vue2和vue3中的常规写法。
vue2迁移到vue3,往往不想去调整之前的代码,以下就使用改动较小的方案进行调整。
In terms of what has changed, at a high level:
- BREAKING: When used on custom components, v-model prop and event default names are changed:
- prop: value -> modelValue;
- event: input -> update:modelValue;
- BREAKING: v-bind's .sync modifier and component model option are removed and replaced with an argument on v-model;
- NEW: Multiple v-model bindings on the same component are possible now;
- NEW: Added the ability to create custom v-model modifiers.
For more information, read on!
以上文档来自
(图片来源网络,侵删)
(图片来源网络,侵删)
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...