Javascript 在axios get请求中传递整数参数
我试图在axios get请求中传递一个整数参数,但在“this.look\u data.Value”键的浏览器值处不是字符串!。。这就是我所做的Javascript 在axios get请求中传递整数参数,javascript,vue.js,axios,Javascript,Vue.js,Axios,我试图在axios get请求中传递一个整数参数,但在“this.look\u data.Value”键的浏览器值处不是字符串!。。这就是我所做的 axios.get(window.App.targetURL+'/ccc/xxx?getint='+encodeURIComponent(this.look_data.value), window.App.configuration) .then(response => {
axios.get(window.App.targetURL+'/ccc/xxx?getint='+encodeURIComponent(this.look_data.value), window.App.configuration)
.then(response => {
this.value = (give.data);
this.values = true;
})
.catch(e => {
alert(e);
})
尝试将其显式转换为字符串:
var d = new Date(this.look_data.value);
var options = {
day: 'numeric',
month: 'long',
year: 'numeric'};
axios.get(window.App.targetURL+'/ccc/xxx?getint='+ encodeURIComponent(d.toLocaleDateString('en-US', options)), window.App.configuration)
.then(response => {
this.value = (give.data);
this.values = true;
})
.catch(e => {
alert(e);
})
如果这不起作用,尝试在格式化日期中转换它。有一些库为您执行此操作,或者看到您缺少“+”---getint='+encodeURIComponent。toString()
仍然无法使用相同的消息此。look_data.value”不是字符串代码>