如何扩展Quasar Vue lib组件属性类型?

问题描述

我有扩展Quasar QTable的组件,并且为列定义添加了一些属性,我想通过扩展Quasar原始列的列接口覆盖这些添加的属性。但是Quasar会以某种方式根据JSON文件https://github.com/quasarframework/quasar/blob/1058f46acd455f37e61c7c7a442435997553b131/ui/src/components/table/QTable.json#L126

中分隔的道具定义生成类型

它生成打字:

export interface QTable extends Vue {
    /**
     * Fullscreen mode
     */
    fullscreen? : boolean
    /**
     * Changing route app won't exit fullscreen
     */
    noRouteFullscreenExit? : boolean
    /**
     * Rows of data to display
     */
    data? : any[]
    ...
    /**
     * Dense mode; Connect with $q.screen for responsive behavior
     */
    dense? : boolean
    /**
     * The column definitions (Array of Objects)
     */
    columns? : {
            /**
             * Unique id,identifies column,(used by pagination.sortBy,'body-cell-[name]' slot,...)
             */
            name : string
            /**
             * Label for header
             */
            label : string
            /**
             * Row Object property to determine value for this column or function which maps to the required property
             */
            field : string | Function
            /**
             * If we use visible-columns,this col will always be visible
             */
            required? : boolean
            /**
             * Horizontal alignment of cells in this column
             */
            align? : string
            /**
             * Tell QTable you want this column sortable
             */
            sortable? : boolean
            /**
             * Compare function if you have some custom data or want a specific way to compare two rows
             */
            sort? : Function
            /**
             * Function you can apply to format your data
             */
            format? : Function
            /**
             * Style to apply on normal cells of the column
             */
            style? : string
            /**
             * Classes to add on normal cells of the column
             */
      etc...

我知道您可以在打字稿中选择界面的一部分

export interface MyColumn extends QTable['column'] {
  myExtraProperty: string;
}

但是没有列仅导出列,而是一个数组..我想扩展列接口而不是列数组

类似:

export interface MyColumn extends QTable['columns.0']] {
  myExtraProperty: string;
}

有人有解决方案吗?或任何提示?谢谢?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)