vue、git 学习笔记
上一篇笔记见(这里做补充):
git:
克隆Git到本地(建立文件夹):git clone https://xxx
建立分支:git checkout -b 新建分支
返回主题:git checkout master
提交全部 :git add .
提交命名:git commit -m ‘命名’ //提交,添加操作说明
提交:git push -u origin master //将本次更改更新到github项目上去,master可改为分支名称
样式命名
样式命名写法:
- 块:.block
- 元素:.block__element
- 修饰符:.block–modifier
.block {
&__element{
}
&–modifier{
}
}
把分支内容默认到主分支:git merge 1.c.创建项目
vue:
全名:{{getFullName()}}
methods:{
getFullName(){
return this.firstName+this.lastName;
}
}
全名:{{fullName}}
computed:{
fullName(){
return this.firstName+this.lastName;
}
}
相比方法的区别:
1)属性值不变,计算属性不会反复调用;方法会每次渲染的时候无论是否变化都会执行;
2)计算属性不能传递参数,方法可以传递参数;
3)计算属性可以配置get和set,分别用于读取时和设置时;
computed:{
fullName:{
get(){
return this.firstName + this.lastName;
},
set(newVal){
this.firstName = newVal[0];
this.lastName = newVal.substr(1);
}
}
}