【发布时间】:2018-03-05 09:29:18
【问题描述】:
我正在使用引导数据表和 vue.js 和 当我在创建 vue 模型后尝试调用 DataTable 函数时,它不起作用,为什么? 我也试过 $(app.$el).datatable() ,但没有用。 这是我的代码
<table id="example" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th class="all">First name</th>
<th class="desktop">Last name</th>
</tr>
</thead>
<tbody>
<tr v-for="ws in workschedule">
<td>test</td>
<td>test</td>
</tr>
</tbody>
</table>
$(document)
.ready(function () {
var app = new Vue({
el: '#example',
data: {
workschedule: []
},
created: function () {
this.getSchedule();
},
methods: {
getSchedule: function() {
var autourl =
'get.aspx?op=json&table=StoreUserWorkSchedule&qd=storeuserworkschedule' + appendTime();
this.$http.get(autourl)
.then(function(response) {
this.workschedule = response.data;
});
}
}
});
$('#example').DataTable({
responsive: true
});
});
【问题讨论】: