
es6
慕宁儿
这个作者很懒,什么都没留下…
展开
-
使用ES6扩展运算符合并对象
语法obj = {...obj1,...obj2}合并两个对象的相同属性以obj2为准,不同属性会进行拼接。示例const state1 = { isFirst:false, isLoading:true, userList:[], isError:false}const state2 = { isLoading:false, userList:'res.data.items', isError:false}let state = {...state1,...state2}c原创 2021-08-17 15:34:30 · 824 阅读 · 0 评论 -
关于Vue使用es6模板字符串没反应的问题
错误示范VScode发get请求的地址及参数使用单引号''包裹时,发现${this.keyWord}没有变颜色,跟字符串一个颜色,也就是没有将this.keyWord识别成变量,当成了一般字符串,发请求时带的参数问题请求不到结果search(){ this.$axios.get('https://api.github.com/search/users?q=${this.keyWord}').then( res => { console.log(res); }, err =>原创 2021-08-15 23:13:42 · 1588 阅读 · 0 评论