Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicTable的columns使用ref动态赋值时;ts报错,显示正常。 #46

Open
vnext2024 opened this issue May 8, 2024 · 0 comments

Comments

@vnext2024
Copy link

ts错误信息:不能将类型“({ children: ({ children: (... | { title?: VNodeChildAtom | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeChildAtom[] | ((props: ColumnTitleProps<...>) => ColumnTitleNode) | (VNodeChildAtom | (VNodeChildAtom | (VNodeChildAtom | (VNodeChildAtom | (VNodeChildAtom | (VNodeChildAtom | (VNodeChildA...”分配给类型“TableColumn[]”。ts-plugin(2322) dynamic-table.ts(27, 3): 所需类型来自属性 "columns",在此处的 "{ readonly columns: TableColumn[]; } & { readonly search?: boolean | undefined; readonly size?: SizeType; readonly components?: TableComponents<any> | undefined; ... 63 more ...; readonly rowSelection?: TableRowSelection<...> | undefined; } & { ...; } & {} & Record<...>" 类型上声明该属性

<DynamicTable row-key="id" header-title="参数配置" :data-request="loadData" :columns="tableColumns" bordered size="small" > <template #toolbar> <a-button type="primary" @click="openMenuModal({})"> 新增 </a-button> </template> </DynamicTable>

const tableColumns = ref<TableColumnItem[]>([]); /** 此处异步请求后台,获取显示列 */ loadTableColumn(() => { tableColumns.value = [.......] })

ts基础不牢,不知道怎么解决错误。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant