踩坑
router
- 记得
Vue.use(VueRouter)否则会报name错误 - route-link & view 不是router
- children 是 [ ],路径不要带 /
- 路由配置props时 ,组件接收也要props
- 默认高亮样式
router-link-active - link 和 view 可以不用在同组件中
<div><Tabbar></Tabbar> //route-link在子组件里<router-view></router-view></div>
生命周期
- 生命周期写在methods外边
- 名字规律 befor+Xx 或 xx+ed
- beforUpdate & update 时指dom的value或text 不是data中的数据(此处输出data中数据是最新的)
Vuex
- new Vuex.Store( {对象} )
- [JIA] ({commit},value){} 中括号形式获取遍历作为函数名
- getters不要进行state的赋值操作
watch
- 修改对象第一层就要深度监视 deep:true
- 有两个参数 new & old
- set(){ 此处不写return 应写this.xx=xx}
列表
- 添加对象
this.$set(this.student,'sex','男')
修改数组
this.student.hobby[0]='开车'//错误 this.student.hobby.splice(0,1,'开车') Vue.set(this.student.hobby,0,'开车') this.$set(this.student.hobby,0,'开车')slot - 插槽
插槽组件写外层样式 , 使用插槽的组件定义插槽样式 ```vue
左边
2. 作用于插槽
```vue
//component
<template #firstname="getnames">
<li v-for="(name,index) in getnames.names" :key="index">{{name}}</li>
</template>
//插槽组件
<slot name="firstname" :names="names"></slot>
Mustache语法:
调试工具-插件
https://www.jianshu.com/p/63f09651724c
组件切换虚拟Dom问题
data与el的两种写法
$mount经常被使用到插件中


