vue3中其他的改变

1.全局API的转移

2.x全局api(Vue) 3.x全局api(app)
Vue.config.xxx app.config.xxx
Vue.config.productionTip 移除
Vue.component app.component
Vue.directive app.directive
Vue.mixin app.mixin
Vue.use app.use
Vue.prototype app.config.globalProperties

 

 

 

 

 

 

 

 

 

2.其他改变

  •  过度类名的更改,详细看官网API transition
  • 移除keyCode作为v-on的修饰符,同时也不再支持config.keyCodes
  • 移除v-on.native修饰符

  vue3中给子组件绑定原生事件

  父组件中绑定事件

<my-component 
   v-on:close='handleClose'
   v-on:click='handleClick'
/>

  子组件中声明自定义事件,emits里面写的是自定义事件,如果把click一并写进去,那么click将会被当作自定义事件处理,而不是原生click事件。

<script>
    export default {
        emits:['close']
    }
<script/>
  • 移除过滤器(filter)
posted @ 2021-12-22 16:13  初生土豆  阅读(88)  评论(0编辑  收藏  举报