来欣赏一首音乐 所有的才华也需要知识来堆砌 music.163.com/song?id=573…
总结遍历数组
//for 循环
`for (let i=0;i< this.index.length; i++) {
let father = this.index[i].father;
}
//for-in 循环
for (let i in Array) {
console.log(i);
}
//数组方法 .forEach()
Array.forEach((i, v) => {
console.log(i, v);
});
//for-of 循环
for(let i of Array) {
console.log(i);
}
展示一下
生命周期
生命周期(包含父子组件)
graph TD
new实例--> beforeCreate服务器端渲染期间被调用-->created服务器端渲染期间被调用-->beforeMount在挂载开始之前被调用-->mounted挂载成功在el被新创建的vm.$el替换-->beforeUpdate数据更新时调用-->updated组件DOM已经更新完毕-->beforeDestory组件销毁前-->destoryed组件销毁之后
组件通讯:父子传值&vuex
- 父传子:用 props
- 子传父:用 $emit - vuex:组件间状态共享
- state :存放所有状态
- getters :加工state成员给外界
- mutations :state成员修改、删除(设置为null)操作
- actions :异步操作,可整合调用mutations
- modules :模块化状态管理