@qin-ui/antd-vue-pro 2.5.3 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-CONTEXT.md +30 -10
- package/api.json +23 -3
- package/es/antd-vue-pro.css +6 -6
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
- package/es/components/component-provider/types/index.d.ts +1 -1
- package/es/components/component-provider/types/index.d.ts.map +1 -1
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseField/utils/index.d.ts +1 -2
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
- package/es/components/table/components/ProTable.vue.d.ts +11 -3
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
- package/es/components/table/components/TableEllipsisTooltip.vue.d.ts +19 -0
- package/es/components/table/components/TableEllipsisTooltip.vue.d.ts.map +1 -0
- package/es/components/table/hooks/useEllipsisTooltip.d.ts +45 -0
- package/es/components/table/hooks/useEllipsisTooltip.d.ts.map +1 -0
- package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts +19 -0
- package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts.map +1 -0
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/index.d.ts.map +1 -1
- package/es/components/table/types/index.d.ts +47 -2
- package/es/components/table/types/index.d.ts.map +1 -1
- package/es/index.js +544 -118
- package/es/index.js.map +1 -1
- package/es/shared/core/index.d.ts +1 -1
- package/es/shared/core/index.d.ts.map +1 -1
- package/es/shared/ui/index.d.ts +2 -1
- package/es/shared/ui/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/component-provider/components/index.vue +31 -8
- package/src/components/component-provider/types/index.ts +1 -0
- package/src/components/form/components/BaseField/index.vue +21 -12
- package/src/components/form/components/BaseField/utils/index.ts +5 -5
- package/src/components/form/components/ProForm/index.vue +9 -2
- package/src/components/table/components/ProTable.vue +198 -71
- package/src/components/table/components/TableEllipsisTooltip.vue +90 -0
- package/src/components/table/hooks/useEllipsisTooltip.ts +244 -0
- package/src/components/table/hooks/useEllipsisTooltipColumns.ts +154 -0
- package/src/components/table/index.ts +7 -1
- package/src/components/table/types/index.ts +63 -2
- package/src/shared/core/index.ts +2 -0
- package/src/shared/ui/index.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 统一 re-export @qin-ui/pro-components-core,包内所有文件通过此文件引入 core 内容。
|
|
3
3
|
*/
|
|
4
|
-
export { type AdditionalMethods, localePacks, normalizeColumn, normalizeColumns, useForm, createFormProxy, useTable, useSearchFormExpand, useFields, resolveFieldIdentity, DEFAULT_FIELD_IDENTITY_KEYS, useFormData, useFormRef, useReactiveAttrs, InjectionFormKey, InjectionFormSlotsKey, getObject, omitBy, get, set, normalizePathKey, toPath, camelizeProperties, cloneDeep, pick, omit, isPlainObject, isObjectItem, isPromise, zhCN, zhTW, enUS, format, resolveLocaleName, type ProLocale, type ProLocaleName, type ProLocaleKey, type Data, type Path, type Paths, type KeyExpandString, type ExtendWithAny, type DeepPartial, type PageParam, type Fields, type Form, type Table, type UseFieldsReturn, type UseFormDataReturn, type UseFormRefReturn, } from '@qin-ui/pro-components-core';
|
|
4
|
+
export { type AdditionalMethods, localePacks, normalizeColumn, normalizeColumns, useForm, createFormProxy, useTable, useSearchFormExpand, useFields, resolveFieldIdentity, DEFAULT_FIELD_IDENTITY_KEYS, useFormData, useFormRef, useReactiveAttrs, InjectionFormKey, InjectionFormSlotsKey, getObject, mergeComponentVars, omitBy, get, set, normalizePathKey, toPath, camelizeProperties, cloneDeep, pick, omit, isPlainObject, isObjectItem, isPromise, callListeners, zhCN, zhTW, enUS, format, resolveLocaleName, type ProLocale, type ProLocaleName, type ProLocaleKey, type Data, type Path, type Paths, type KeyExpandString, type ExtendWithAny, type DeepPartial, type PageParam, type Fields, type Form, type Table, type UseFieldsReturn, type UseFormDataReturn, type UseFormRefReturn, } from '@qin-ui/pro-components-core';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACtB,WAAW,EACX,eAAe,EACf,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EACX,UAAU,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,qBAAqB,EAErB,SAAS,EACT,MAAM,EACN,GAAG,EACH,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACtB,WAAW,EACX,eAAe,EACf,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EACX,UAAU,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,qBAAqB,EAErB,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,GAAG,EACH,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,SAAS,EACT,aAAa,EAEb,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC"}
|
package/es/shared/ui/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FormProps as _FormProps, Table, TableProps as _TableProps } from 'ant-design-vue';
|
|
2
2
|
import { ComponentProps } from 'vue-component-type-helpers';
|
|
3
3
|
import { Options } from 'scroll-into-view-if-needed';
|
|
4
|
-
export { theme, Form, FormItem, Row as Grid, Col as GridItem, Table, Space, MenuDivider, Dropdown, Menu, MenuItem, Checkbox, Button, Cascader, CheckboxGroup, DatePicker, Input, InputNumber, InputPassword, InputSearch, RadioGroup, Select, Slider, Switch, Textarea, TimePicker, Transfer, TreeSelect, RangePicker, type FormItemInstance, type FormInstance, type RowProps as GridProps, type ColProps as GridItemProps, type FormItemProps, type PaginationProps, } from 'ant-design-vue';
|
|
4
|
+
export { theme, Form, FormItem, Row as Grid, Col as GridItem, Table, TableColumn, Space, MenuDivider, Dropdown, Menu, MenuItem, Checkbox, Button, Cascader, CheckboxGroup, DatePicker, Input, InputNumber, InputPassword, InputSearch, RadioGroup, Select, Slider, Switch, Textarea, TimePicker, Transfer, TreeSelect, RangePicker, Tooltip, type FormItemInstance, type FormInstance, type RowProps as GridProps, type ColProps as GridItemProps, type FormItemProps, type PaginationProps, } from 'ant-design-vue';
|
|
5
5
|
export { type ColumnType, tableProps } from 'ant-design-vue/es/table';
|
|
6
|
+
export type { TooltipProps } from 'ant-design-vue';
|
|
6
7
|
export { type RangePickerProps } from 'ant-design-vue/es/date-picker';
|
|
7
8
|
export { useConfigContextInject } from 'ant-design-vue/es/config-provider/context';
|
|
8
9
|
export { useInjectDisabled, useProviderDisabled, } from 'ant-design-vue/es/config-provider/DisabledContext';
|
|
@@ -1 +1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AQ,IAAI,aAAa,EAC9B,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,oDAAoD;AACpD,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,GAAG;IAC/D,kBAAkB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,0BAA0B,CAAC,EAAE,cAAc,CACzC,OAAO,KAAK,CACb,CAAC,0BAA0B,CAAC,CAAC;CAC/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qin-ui/antd-vue-pro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "二次封装antd vue组件",
|
|
5
5
|
"bin": {
|
|
6
6
|
"antd-vue-pro": "./bin/init-ai.mjs"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
46
46
|
"vue-component-type-helpers": "^3.2.5",
|
|
47
|
-
"@qin-ui/pro-components-core": "^2.
|
|
47
|
+
"@qin-ui/pro-components-core": "^2.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^24",
|
|
@@ -36,8 +36,8 @@ import {
|
|
|
36
36
|
ensureInjectConfig,
|
|
37
37
|
} from '../constants';
|
|
38
38
|
import type { ComponentVars } from '../types';
|
|
39
|
-
import { computed, provide } from 'vue';
|
|
40
|
-
import { getObject, omit } from '../../../shared/core';
|
|
39
|
+
import { computed, inject, provide, toValue, type InjectionKey } from 'vue';
|
|
40
|
+
import { getObject, mergeComponentVars, omit } from '../../../shared/core';
|
|
41
41
|
import type { ComponentName } from '../../form/constants';
|
|
42
42
|
import { LOCALE_INJECT_KEY, type ProLocale } from '../../../locale';
|
|
43
43
|
|
|
@@ -77,20 +77,25 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
/*
|
|
80
|
-
* 遍历 componentVars 的每个 key
|
|
81
|
-
*
|
|
80
|
+
* 遍历 componentVars 的每个 key,读取祖先注入值与本层配置合并后向下 provide
|
|
81
|
+
* 合并顺序为内置默认值 → 祖先注入值 → 本层 componentVars,剔除该注入项的不可注入键
|
|
82
82
|
* 子组件通过 inject(config.injectionKey) 获取合并后的计算属性配置
|
|
83
83
|
*/
|
|
84
84
|
(Object.keys(INJECT_CONFIG) as Array<keyof typeof INJECT_CONFIG>).forEach(
|
|
85
85
|
key => {
|
|
86
86
|
const config = INJECT_CONFIG[key];
|
|
87
87
|
const ignored = config.ignoreProps;
|
|
88
|
+
const parentConfig = inject(
|
|
89
|
+
config.injectionKey as InjectionKey<any>,
|
|
90
|
+
undefined
|
|
91
|
+
);
|
|
88
92
|
provide(
|
|
89
93
|
config.injectionKey,
|
|
90
94
|
computed(() =>
|
|
91
95
|
omit(
|
|
92
96
|
{
|
|
93
97
|
...config.default,
|
|
98
|
+
...(toValue(parentConfig) || {}),
|
|
94
99
|
...getObject(props.componentVars?.[key as keyof ComponentVars]),
|
|
95
100
|
},
|
|
96
101
|
ignored ?? []
|
|
@@ -105,10 +110,14 @@ if (props.componentVars) {
|
|
|
105
110
|
Object.keys(props.componentVars).forEach(key => {
|
|
106
111
|
if (!(key in INJECT_CONFIG)) {
|
|
107
112
|
const config = ensureInjectConfig(key);
|
|
113
|
+
const parentConfig = inject(
|
|
114
|
+
config.injectionKey as InjectionKey<any>,
|
|
115
|
+
undefined
|
|
116
|
+
);
|
|
108
117
|
provide(
|
|
109
118
|
config.injectionKey,
|
|
110
119
|
computed(() => ({
|
|
111
|
-
...
|
|
120
|
+
...(toValue(parentConfig) || {}),
|
|
112
121
|
...getObject((props.componentVars as any)?.[key]),
|
|
113
122
|
}))
|
|
114
123
|
);
|
|
@@ -116,22 +125,36 @@ if (props.componentVars) {
|
|
|
116
125
|
});
|
|
117
126
|
}
|
|
118
127
|
|
|
128
|
+
const parentComponentVars = inject(INJECT_COMPONENT_VARS, undefined);
|
|
119
129
|
// 全量 componentVars:自定义组件键在运行期新增后同样可被子组件读取
|
|
120
130
|
provide(
|
|
121
131
|
INJECT_COMPONENT_VARS,
|
|
122
|
-
computed(() =>
|
|
132
|
+
computed(() =>
|
|
133
|
+
mergeComponentVars(
|
|
134
|
+
toValue(parentComponentVars),
|
|
135
|
+
props.componentVars as Record<string, any>
|
|
136
|
+
)
|
|
137
|
+
)
|
|
123
138
|
);
|
|
124
139
|
|
|
140
|
+
const parentComponents = inject(INJECT_COMPONENTS, undefined);
|
|
125
141
|
// 注入自定义组件映射,BaseField 在解析组件时会优先使用此映射
|
|
126
142
|
provide(
|
|
127
143
|
INJECT_COMPONENTS,
|
|
128
|
-
computed(() =>
|
|
144
|
+
computed(() => ({
|
|
145
|
+
...(toValue(parentComponents) || {}),
|
|
146
|
+
...(props.componentMap ?? {}),
|
|
147
|
+
}))
|
|
129
148
|
);
|
|
130
149
|
|
|
150
|
+
const parentLocale = inject(LOCALE_INJECT_KEY, undefined);
|
|
131
151
|
// 注入内置文案覆盖,useLocale 在解析文案时会优先使用
|
|
132
152
|
provide(
|
|
133
153
|
LOCALE_INJECT_KEY,
|
|
134
|
-
computed(() =>
|
|
154
|
+
computed(() => ({
|
|
155
|
+
...(toValue(parentLocale) || {}),
|
|
156
|
+
...(props.locale ?? {}),
|
|
157
|
+
}))
|
|
135
158
|
);
|
|
136
159
|
</script>
|
|
137
160
|
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
cloneDeep,
|
|
42
42
|
getObject,
|
|
43
|
+
omitBy,
|
|
43
44
|
useReactiveAttrs,
|
|
44
45
|
} from '../../../../shared/core';
|
|
45
46
|
import {
|
|
@@ -126,20 +127,23 @@ onBeforeUnmount(() => {
|
|
|
126
127
|
const attrs: any = useReactiveAttrs();
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
|
-
*
|
|
130
|
+
* 全局默认配置注入:按组件名与 picker 修饰段分别解析注入通道,inject 须在 setup 同步期调用。
|
|
130
131
|
* 组件名与 `picker` 仅取 setup 期初始值——运行期变更不会切换 Provider 的默认值预设
|
|
131
132
|
* (`date-picker.month` 等子类型预设需在初始渲染前确定)。
|
|
133
|
+
* `date-picker` 的 picker 缺省时按 `date` 段解析子类型预设。
|
|
132
134
|
*/
|
|
133
135
|
const pickerVal = attrs.picker;
|
|
134
|
-
const
|
|
135
|
-
typeof props.component === 'string'
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
?
|
|
136
|
+
const baseConfigKey =
|
|
137
|
+
typeof props.component === 'string' ? props.component : '';
|
|
138
|
+
const pickerConfigKey =
|
|
139
|
+
pickerVal || (baseConfigKey === 'date-picker' ? 'date' : '');
|
|
140
|
+
const subtypeConfigKey =
|
|
141
|
+
baseConfigKey && pickerConfigKey ? `${baseConfigKey}.${pickerConfigKey}` : '';
|
|
142
|
+
const baseInjectConfig = baseConfigKey
|
|
143
|
+
? getInjectConfig(baseConfigKey)
|
|
140
144
|
: undefined;
|
|
141
|
-
const
|
|
142
|
-
?
|
|
145
|
+
const subtypeInjectConfig = subtypeConfigKey
|
|
146
|
+
? getInjectConfig(subtypeConfigKey)
|
|
143
147
|
: undefined;
|
|
144
148
|
// 全量 componentVars:运行期新增的自定义组件键由此兜底读取
|
|
145
149
|
const componentVars = inject(INJECT_COMPONENT_VARS, undefined);
|
|
@@ -197,9 +201,12 @@ const parentDisabled = useInjectDisabled();
|
|
|
197
201
|
* 属性分为三类:绑定属性(v-model)、组件属性(传递给组件)、插槽(动态渲染)
|
|
198
202
|
*/
|
|
199
203
|
const groupedAttrs = computed(() => {
|
|
204
|
+
// 库内置默认(基础键 → 子类型键)之后再铺项目配置,项目配置始终覆盖库默认
|
|
200
205
|
const currentInjectProps = {
|
|
201
|
-
...(
|
|
202
|
-
...getObject(
|
|
206
|
+
...getObject(baseInjectConfig?.default),
|
|
207
|
+
...getObject(subtypeInjectConfig?.default),
|
|
208
|
+
...getObject(toValue(componentVars)?.[baseConfigKey]),
|
|
209
|
+
...getObject(toValue(componentVars)?.[subtypeConfigKey]),
|
|
203
210
|
};
|
|
204
211
|
const initProps = getInitProps(
|
|
205
212
|
{ component: props.component, picker: attrs.picker } as Field,
|
|
@@ -207,9 +214,11 @@ const groupedAttrs = computed(() => {
|
|
|
207
214
|
t
|
|
208
215
|
);
|
|
209
216
|
const effectiveModelProp = attrs.modelProp ?? initProps.modelProp ?? 'value';
|
|
217
|
+
// 未赋值(undefined)的键不作为显式值下发,保留注入默认值与占位符兜底
|
|
218
|
+
const definedAttrs = omitBy(attrs, value => value === undefined);
|
|
210
219
|
const mergedProps = mergeProps(
|
|
211
220
|
initProps,
|
|
212
|
-
|
|
221
|
+
definedAttrs,
|
|
213
222
|
{ class: attrs.componentClass, style: attrs.componentStyle },
|
|
214
223
|
{ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
|
|
215
224
|
{ modelProp: effectiveModelProp }
|
|
@@ -29,8 +29,7 @@ const getPlaceholderProps = (
|
|
|
29
29
|
/**
|
|
30
30
|
* 解析字段的 Provider 默认属性
|
|
31
31
|
*
|
|
32
|
-
* @description
|
|
33
|
-
* `date-picker` 不拼接 `picker` 段,其子类型预设由注入 key 在 BaseField 内单独解析
|
|
32
|
+
* @description 仅字符串组件名取注入值;占位符兜底按基础组件名解析,组件对象无注入配置,返回空对象。
|
|
34
33
|
*
|
|
35
34
|
* @param field - 字段配置项
|
|
36
35
|
* @param injectProps - 该组件名对应的 Provider 注入默认值
|
|
@@ -43,10 +42,11 @@ export const getInitProps = (
|
|
|
43
42
|
t: LocaleT
|
|
44
43
|
): Record<string, any> => {
|
|
45
44
|
const { component } = field as any;
|
|
46
|
-
const picker = component === 'date-picker' ? '' : (field as any).picker;
|
|
47
45
|
if (typeof component === 'string') {
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return {
|
|
47
|
+
...injectProps,
|
|
48
|
+
...getPlaceholderProps(component, injectProps, t),
|
|
49
|
+
};
|
|
50
50
|
}
|
|
51
51
|
return {};
|
|
52
52
|
};
|
|
@@ -101,7 +101,14 @@ const fields = computed(() => {
|
|
|
101
101
|
return (Array.isArray(f) ? f : f?.value) ?? [];
|
|
102
102
|
});
|
|
103
103
|
const formData = computed(() => currentForm.value?.formData);
|
|
104
|
-
|
|
104
|
+
/*
|
|
105
|
+
* ref 回调按渲染期实例路由:卸载回调(null)写回该子树所属表单,
|
|
106
|
+
* 运行期替换 :form 后旧实例的 formRef 同步清空
|
|
107
|
+
*/
|
|
108
|
+
const formRefSetter = computed(() => {
|
|
109
|
+
const form = currentForm.value;
|
|
110
|
+
return (el: any) => form?.setFormRef?.(el);
|
|
111
|
+
});
|
|
105
112
|
|
|
106
113
|
/*
|
|
107
114
|
* formKey 子树重挂载契约:以 WeakMap 为每个 form 实例生成自增 key,绑定到原生 Form 的 :key
|
|
@@ -160,7 +167,7 @@ provide(InjectionFormSlotsKey, formSlotsRef);
|
|
|
160
167
|
<template>
|
|
161
168
|
<AForm
|
|
162
169
|
:key="formKey"
|
|
163
|
-
:ref="
|
|
170
|
+
:ref="formRefSetter"
|
|
164
171
|
:model="formData"
|
|
165
172
|
v-bind="formAttrs"
|
|
166
173
|
class="pro-form"
|