全局 API
全局 API 应用实例
- Vue.config -> app.config
- Vue.config.productionTip -> 移除
- Vue.config.ignoreElements -> app.config.compilerOptions.isCustomElement
- Vue.component -> app.component
- Vue.directive -> app.directive
- Vue.mixin -> app.mixin
- Vue.use -> app.use
- Vue.prototype -> app.config.globalProperties
- Vue.extend -> 移除
全局 API Treeshaking
- Vue.nextTick() -> nextTick()
- Vue.observable -> reactive()
- Vue.version -> version
- Vue.compile(仅完整构建版本)
- Vue.set(仅兼容构建版本)
- Vue.delete(仅兼容构建版本)
模板指令
v-model
参见 vue3.md 的 v-model 指令部分
key 使用改变
对于 v-if
, v-else-if
, v-else
的各分支项 key
将不再是必须的, Vue 会自动生成唯一的 key
v-if 和 v-for 优先级
两者作用于同一个元素上时,v-if 会拥有比 v-for 更高的优先级
v-bind 合并行为
v-bind
的绑定顺序会影响渲染结果
- vue 2.x 独立绑定的 attribute 会覆盖 v-bind 中的 attribute
- vue 3.x 根据声明顺序决定如何被合并
1 | <!-- 模板 --> |