我用的是制表器和Sveltekit。这是我的制表器-组件:
<script lang="ts">
import { Tabulator } from 'tabulator-tables';
import type { ColumnDefinition } from 'tabulator-tables';
import { onMount } from 'svelte';
export let data: any[], columns: ColumnDefinition[];
let tableComponent: HTMLElement;
onMount(() => {
new Tabulator(tableComponent, {
data: data, //link data to table
columns: columns, //define table columns,
pagination: true,
reactiveData: true
});
});
</script>
<div bind:this="{tableComponent}"></div>
<svelte:head>
<link
href="https://unpkg.com/tabulator-tables@4.9.1/dist/css/tabulator.min.css"
rel="stylesheet" />
</svelte:head>该表呈现良好,但是分页和reactiveData选项不起作用,它表示它的“无效”:
警告无效的表构造函数选项:-“分页”(client.js,第1593行) 警告无效的表构造函数选项:- "reactiveData“(client.js,第1593行)
我做错了什么?
提前谢谢M
发布于 2022-11-08 11:39:52
一些制表器的功能被分割成必须首先注册的模块,或者加载所有的东西(这会导致比必要的更大的包大小)。
登记:
import { Tabulator, PageModule, ReactiveDataModule } from 'tabulator-tables';
Tabulator.registerModule([PageModule, ReactiveDataModule]);(可用模块)
或全部进口:
import { TabulatorFull as Tabulator } from 'tabulator-tables';另外,pagination应该是一个字符串:'local'或'remote'
https://stackoverflow.com/questions/74359456
复制相似问题