【发布时间】:2018-04-25 20:18:51
【问题描述】:
大家好,我想知道这两种单引号`和'有什么区别
我尝试用`执行下面的命令然后它工作了
axios.get(`https://api.github.com/users/${this.state.userName}`)
.then(resp => {
console.log(resp);
});
但是当我尝试使用 '' 运行相同的命令时它不起作用
axios.get('https://api.github.com/users/${this.state.userName}')
.then(resp => {
console.log(resp);
});
【问题讨论】:
-
一般来说,如果你遵循一种语言的规定语法,并且它有效,你为什么要改变语法然后抱怨什么都不起作用?
-
这个问题在这里肯定有无数次重复。