我在我的 vue 应用程序中创建了一个制表符组件,我正在传递制表符选项data并columns通过道具如下:
// parent component
<template>
<div>
<Tabulator :table-data="materialsData" :table-columns="options.columns" :is-loading="materials.isLoading" />
</div>
</template>
...
// Tabulator component
props: {
tableData: {
type: Array,
default: function() {
return [
{ name: "Billy Bob", age: "12" },
{ name: "Mary May", age: "1" },
];
},
},
tableColumns: {
type: Array,
default: function() {
return [
{ title: "Name", field: "name", sorter: "string", width: 200, editor: true },
{ title: "Age", field: "age", sorter: "number", align: "right", formatter: "progress" },
];
},
},
isLoading: {
type: Boolean,
default: true,
},
},
mounted() {
// instantiate Tabulator
this.tabulator = new Tabulator(this.$refs.table, {
placeholder: "loading data...",
//placeholder: "<font-awesome-icon icon='circle-notch' spin size='2x' />",
data: this.tableData, // link data to table (passed as prop)
columns: this.tableColumns, // define table columns (passed as prop)
});
},
除了向用户指示数据正在加载之外,一切都运行良好。我首先尝试使用占位符选项 ( http://tabulator.info/docs/4.7/layout#placeholder ) 但意识到它不适用,因为它也在没有数据显示时呈现。
有没有办法告诉 Tabulator 根据我的道具优先呈现加载微调器或文本isLoading?
慕无忌1623718
杨__羊羊
相关分类