我是Vue JS的新手,但现在已经使用JavaScript很长时间了。我已经通过onewaytech安装了vue2-datatable-component,并且一直在使用他们发布的Advanced Example。表工作正常,但我正在尝试让操作列中的按钮执行ajax调用,以删除该行中显示的对象。我在文档中没有看到任何关于将唯一ID传递给td-Opt的内容,所以我被卡住了。
发布于 2018-06-02 04:14:43
您将不得不使用动态组件来创建它。例如:
data () {
return {
props: ['row'],
supportBackup: true,
supportNested: true,
tblClass: 'table-bordered',
tblStyle: 'color: #666',
pageSizeOptions: [5, 10, 15, 20],
columns: [
{title: '#', field: 'uid', sortable: true},
{title: 'Date', field: 'date_at', sortable: true},
{title: 'Nombre', field: 'name', sortable: true},
{title: 'Precio', field: 'total_price', sortable: true},
{title: 'Action', field: 'action', tdComp: 'Opt'},
],
data: [],
total: 0,
selection: [],
query: {},
}`enter code here`
},
其中,选项:
import actionItem from "../xxx.vue";
import DisplayRow from "../Utils/nested-DisplayRow.vue";
components: {"Opt": actionItem, , 'DisplayRow': DisplayRow},
所以..。在您的ActionItem组件中,您可以创建组件...该组件将成为您的行操作
https://stackoverflow.com/questions/49756751
复制相似问题