We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
render 函数声明:
render
https://github.com/anncwb/vue-vben-admin/blob/85729f0f40db3fd14984d31263dc5bd39306c28e/src/components/Description/src/types.ts#L19
export interface DescItem { labelMinWidth?: number; contentMinWidth?: number; labelStyle?: CSSProperties; field: string; label: string | VNode | JSX.Element; // Merge column span?: number; show?: (...arg: any) => boolean; // render render?: ( val: string, data: Recordable ) => VNode | undefined | JSX.Element | Element | string | number; }
真实使用 render 函数的地方:
https://github.com/anncwb/vue-vben-admin/blob/85729f0f40db3fd14984d31263dc5bd39306c28e/src/components/Description/src/index.tsx#L95
function renderItem() { const { schema } = unref(getProps); return unref(schema).map((item) => { const { render, field, span, show, contentMinWidth } = item; const { data } = unref(getProps) as DescOptions; if (show && isFunction(show) && !show(data)) { return null; } const getContent = () => isFunction(render) ? render(data?.[field], data) : unref(data) && unref(data)[field]; const width = contentMinWidth; return ( <Descriptions.Item label={renderLabel(item)} key={field} span={span}> {() => { if (!contentMinWidth) { return getContent(); } const style: CSSProperties = { minWidth: `${width}px`, }; return <div style={style}>{getContent()}</div>; }} </Descriptions.Item> ); }); }
render 函数的第二个参数类型为 Recorable(declare type Recordable<T extends any = any> = Record<string, T>),且 val 的值来源于 data?.[field] 和 unref(data)[field],所以 val 的类型应该是 any,而不应该是 string。
declare type Recordable<T extends any = any> = Record<string, T>
data?.[field]
unref(data)[field]
The text was updated successfully, but these errors were encountered:
fix(descriotion): fix type #228
4909a4c
chore: update deps #228
1b71db7
No branches or pull requests
render
函数声明:https://github.com/anncwb/vue-vben-admin/blob/85729f0f40db3fd14984d31263dc5bd39306c28e/src/components/Description/src/types.ts#L19
真实使用 render 函数的地方:
https://github.com/anncwb/vue-vben-admin/blob/85729f0f40db3fd14984d31263dc5bd39306c28e/src/components/Description/src/index.tsx#L95
render 函数的第二个参数类型为 Recorable(
declare type Recordable<T extends any = any> = Record<string, T>
),且 val 的值来源于data?.[field]
和unref(data)[field]
,所以 val 的类型应该是 any,而不应该是 string。The text was updated successfully, but these errors were encountered: