(二十四)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的简写
 
 
posted @   yingxianqi  阅读(171)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示