(二十四)let,const,var区别,created(),mounted()的执行顺序,es6里面 const { id, name, no } = this 代表的意义
////const定义的是一个常量,在其他地方ss3.name="xxx"可以,但是不能ss3={xx:""}呢样直接给ss3赋值,,因为ss3是个常量
//const ss3={name:"1122"};
// //var定义的是一个变量,ssff可以在其他地方赋值,ssff里面的属性也可以在其他地方赋值
// var ssff = { sdf: "", fdssd: "" };
////let定义的是一个变量,如果在{ }里面他的作用就只能在{ }内,var作用可以在{ }外,呢是他们的区别,其他基本一样
// let ff={ssf:"ggg",fffs:"ttt"};
// }
//vue实例创建好,但是呢时候页面的templete模板里面的内容还没有编译成html,因此不能对dom操作,只能初始化一些数据
created(){
}
//vue实例话完成,templete模板被编译成html完成,已经完成了页面和数据的双向绑定,通常做页面已经完成后的一些后续操作
mounted() {
//下面的写法相当于const id=this.id; const name=this.name;const no=this.no的简写
const { id, name, no } = this;
console.log(id + " " + name + " " + no);
},
注意:
es6里面的新语法:const { id, name, no } = this;
其实就是:const id=this.id; const name=this.name;const no=this.no的简写