Vue.js 对象在vue中的axios请求中未作为参数发送 继续 导出默认值{ 数据:函数(){ 返回{ 系列:[] } }, 方法:{ getData:函数(类型){ var=这个; 让url; 让数据; 数据={current_page:type,is_worker:true} url='myprofile/user.json' 这个.axios.get(url,{company:data}) 。然后(响应=>{ that.series=response.data.series }); } } };
我试图通过axios get请求传递数据对象,但参数未传递给控制器。请帮我找出哪里出了问题。@mare96 this.$axios.get(url,{params:{company:type,is_-worker:true})这样的it工作者。但我正在努力改进我的代码,这就是为什么我要创建一个数据对象并随请求一起发送它Vue.js 对象在vue中的axios请求中未作为参数发送 继续 导出默认值{ 数据:函数(){ 返回{ 系列:[] } }, 方法:{ getData:函数(类型){ var=这个; 让url; 让数据; 数据={current_page:type,is_worker:true} url='myprofile/user.json' 这个.axios.get(url,{company:data}) 。然后(响应=>{ that.series=response.data.series }); } } };,vue.js,axios,Vue.js,Axios,我试图通过axios get请求传递数据对象,但参数未传递给控制器。请帮我找出哪里出了问题。@mare96 this.$axios.get(url,{params:{company:type,is_-worker:true})这样的it工作者。但我正在努力改进我的代码,这就是为什么我要创建一个数据对象并随请求一起发送它 <template> <div> <v-btn class="red-button next-btn" @click=&q
<template>
<div>
<v-btn class="red-button next-btn" @click="getData("homepage")">
Continue
</v-btn>
</div>
</template>
<script>
export default {
data: function() {
return {
series: []
}
},
methods: {
getData: function (type) {
var that = this;
let url;
let data;
data = { current_page: type, is_worker: true }
url = 'myprofile/user.json'
this.$axios.get(url, { company: data })
.then(response => {
that.series = response.data.series
});
}
}
};
</script>