组件
什么是组件:?
一个小的功能分区,是可以重复使用的模块
复杂项目拆分简单的组件让团队开发更高效;
定义组件
const toggle={
template:`<button @click="change"><span v-if="open">开</span><span v-else>关</span></button>`,
data(){
return{
open:this.value
}
}
注册组件
Vue.createApp({
//注册组件
components: { steper },
data() {
return {
w1: 10,
w2: 10
}
}
}).mount(".app")
注册组件:components:{ }
使用组件
上面我们定义了组件,下面来使用组件
<step></step>
<step></step>
组件的参数传递
props父传子
<steper:value="5">
ste