我试图在axios get请求中传递一个整数参数,但是在浏览器中,键“ this.look_data.value”的值不是字符串!
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);
})
如果这不起作用,请尝试在格式化日期后进行转换。有一些librarie可以为您执行此操作或查看此帖子
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句