From 837cfc0beae6a09d0a7952f6f4bb3d16007dcbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E8=90=BD=E9=9F=B3=E9=98=91?= <424532913@qq.com> Date: Wed, 14 Jul 2021 19:25:05 +0800 Subject: [PATCH] fix(vue): fix field doesnt update correctly in designable mode (#1799) --- packages/vue/docs/api/shared/schema.md | 5 +- .../recursion-field-with-component.vue | 2 +- .../vue/docs/demos/api/hooks/use-field.vue | 71 ++++++++++--------- .../vue/docs/demos/api/hooks/use-form.vue | 29 ++++---- packages/vue/src/__tests__/field.spec.ts | 51 ++++++++++--- packages/vue/src/components/ArrayField.ts | 29 +++++--- packages/vue/src/components/Field.ts | 24 ++++--- packages/vue/src/components/FormProvider.ts | 11 +-- packages/vue/src/components/ObjectField.ts | 29 +++++--- packages/vue/src/components/VoidField.ts | 26 ++++--- packages/vue/src/hooks/useAttach.ts | 22 ++---- 11 files changed, 180 insertions(+), 119 deletions(-) diff --git a/packages/vue/docs/api/shared/schema.md b/packages/vue/docs/api/shared/schema.md index 94837dc1beb..78ba89a33b9 100644 --- a/packages/vue/docs/api/shared/schema.md +++ b/packages/vue/docs/api/shared/schema.md @@ -460,9 +460,10 @@ import { Schema } from '@formily/react' Schema.registerVoidComponents(['card', 'tab', 'step']) ``` - +::: warning +

注意,该 api 需要配合 enablePolyfills(['1.0']) 使用

-
+::: ### registerTypeDefaultComponents diff --git a/packages/vue/docs/demos/api/components/recursion-field-with-component.vue b/packages/vue/docs/demos/api/components/recursion-field-with-component.vue index 53820542d6c..f49aee4e7b3 100644 --- a/packages/vue/docs/demos/api/components/recursion-field-with-component.vue +++ b/packages/vue/docs/demos/api/components/recursion-field-with-component.vue @@ -21,8 +21,8 @@ import { RecursionField, useField, useFieldSchema, - observer, } from '@formily/vue' +import { observer } from '@formily/reactive-vue' import 'ant-design-vue/dist/antd.css' const ArrayItems = observer( diff --git a/packages/vue/docs/demos/api/hooks/use-field.vue b/packages/vue/docs/demos/api/hooks/use-field.vue index 02ec01615ac..123727a40bb 100644 --- a/packages/vue/docs/demos/api/hooks/use-field.vue +++ b/packages/vue/docs/demos/api/hooks/use-field.vue @@ -10,12 +10,16 @@ />