【发布时间】:2020-09-10 09:12:05
【问题描述】:
我在 vuetify 中的自定义排序实现存在问题。
<v-data-table
:headers="table.headers"
:items="table.items"
:search="search"
disable-pagination
:header-props="{sortByText: 'sortiere nach...'}"
:loading="loading"
hide-default-footer
:custom-sort="customSort"
@click:row="rowClickHandler"
/>
这是我现在的 customSort 函数
customSort(items, sortBy, sortDesc, locale) {
if (!this.table.loading) {
console.log(items)
console.log(sortBy)
console.log(sortDesc)
console.log(locale)
}
}
问题是我长胖了
Error in render: "TypeError: Cannot read property 'filter' of undefined"
也许这取决于我使用 axios 获取的异步数据?
我在我的created() 块中获取这样的内容
async fetchUsers() {
await axios
.get('myApiPath')
.then((res) => {
this.table.items = res.data
this.table.loading = false
})
.catch((err) => {
console.log(err)
})
},
【问题讨论】:
标签: vue.js axios vuetify.js