【发布时间】:2018-09-10 05:03:23
【问题描述】:
伙计们,我是 Vue 新手,所以不知道如何解决这个问题让我先显示代码然后问题,我正在使用 Vue-Good-table 这里是链接https://xaksis.github.io/vue-good-demos/#/simple-table
<vue-good-table
title="Product List"
:columns="columns"
:rows="rows"
:paginate="true"
:lineNumbers="true" />
export default {
data(){
return {
columns: [
{
label: 'productname',
field: 'product_name',
filterable: true,
},
{
label: 'productdesc',
field: 'product_desc',
// type: 'number',
html: false,
filterable: true,
},
],
rows:[],//get axios return value
};
},
methods:{
next() {
var _this=this
this.$http.get('http://localhost:3000/api/companyproducts')
.then(function (response) {
_this.rows=response.data
})
.catch(function (error) {
});
}
}
}
现在我的问题是如何将这个 axios 响应值附加到好表的行中
【问题讨论】:
-
我会提到你正在用这个调用替换表格的内容,而不是追加。要追加,请使用
rows.push( response.data )方法。
标签: vue.js vue-tables-2