我正在尝试使用如下网址调用查询搜索:
http://localhost/Stellar/public/api/companies?column=name&direction=desc&page=1
在 Vue Js 2.0 中尝试调用这样的东西:
axios.get('$(this.source)?column=$(this.query.column)&direction=$(this.query.direction)$page=$(this.query.page)')
它看起来像这样
http://localhost/Stellar/public/$(this.source)?column=$(this.query.column)&direction=$(this.query.direction)$page=$(this.query.page)
它没有转换数据。帮我解决这个问题。
谢谢。
最佳答案
当您在字符串中显式写出变量时,您并没有引用它们。
做这样的事情:
let source = this.source;
let column = this.query.column;
let direction = this.query.direction;
let page = this.query.page;
axios.get(source+"?column="+column+"&direction="+direction+"&page="+page);
关于javascript - 如何在Vue Js中通过axios调出查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44073376/