五、指令directives
1.自定义指令,可以访问到dom节点
2.directive:{
'focus':{
mounted(el,binding){
//el 当前指令所在的dom
//binding指令相关信息
//binding.value指令的值
}
}
}
3.钩子函数
①created:创建
②beforeMount:父组件挂载前
③mounted:挂载后
④beforeUpdate:更新前
六、组件components
1.把复杂的项目拆分成简单的组件
让团队开发更加高效
组件时可以重复使用的模块
2.理解:组件其实就是一个小的vue,具有data,methods以及watch,computed
3.组件的定义:const steper = {template:'<span>...</span>'}
4.组件注册
components:{steper}
5.组件使用
<steper></steper>
6.组件的参数
父传