一
main.js注册组件
vue2
new Vue({
router,
store,
render: (h) => h(App),
}).$mount('#app')
vue3
const app = createApp(App)
app.use(ElementUI )
app.use(store).use(router).mount('#app')
二
click事件
vue2在父组件上绑定子组件必须绑定才能触发,
vue3在父组件上绑定子组件也会触发
三
slot具名插槽
vue2
父组件
<template slot="title" >
<h1>哈哈哈</h1>
</template>
子组件
<slot name="title">
vue3
父组件
<template v-slot:title>
<h1>哈哈哈</h1>
</template>
子组件
<slot name="title">
四
filter
vue3删除了filter但是可以在methods或者computed中写一个函数然后引用
vue3中中写过滤器
sell(){
if(this.shop.sells<10000){
return this.shop.sells
}else{
return(this.shop.sells/10000).toFixed(1)+'万'
}
},
vue2中使用过滤器
{{ message | filterA }}
filters: {
if(this.shop.sells<10000){
return this.shop.sells
}else{
return(this.shop.sells/10000).toFixed(1)+'万'
}
}