在axios get请求中传递Integer参数
Passing Integer parameter in axios get request
我试图在 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);
})
如果这不起作用,请尝试将其转换为格式化日期。有一些图书馆为您做这件事或见 this post
我试图在 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);
})
如果这不起作用,请尝试将其转换为格式化日期。有一些图书馆为您做这件事或见 this post