From b07f733efbfc4d77fcf27150e05c769f6c19ebbf Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 22 Oct 2021 10:21:12 +0800 Subject: [PATCH] docs: improve useCustomFieldValue demo (#9709) --- .../vant/docs/markdown/use-custom-field-value.en-US.md | 7 ++++++- .../vant/docs/markdown/use-custom-field-value.zh-CN.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vant/docs/markdown/use-custom-field-value.en-US.md b/packages/vant/docs/markdown/use-custom-field-value.en-US.md index 9b27d0dfa..263d05ee0 100644 --- a/packages/vant/docs/markdown/use-custom-field-value.en-US.md +++ b/packages/vant/docs/markdown/use-custom-field-value.en-US.md @@ -14,11 +14,16 @@ If you want to custom Form items, you can insert your component into the `input` ```js // MyComponent.vue +import { ref } from 'vue'; import { useCustomFieldValue } from '@vant/use'; export default { setup() { - useCustomFieldValue(() => 'Some value'); + const myValue = ref(0); + + useCustomFieldValue(() => myValue.value); + + return { myValue }; }, }; ``` diff --git a/packages/vant/docs/markdown/use-custom-field-value.zh-CN.md b/packages/vant/docs/markdown/use-custom-field-value.zh-CN.md index 764b194f5..173fab0db 100644 --- a/packages/vant/docs/markdown/use-custom-field-value.zh-CN.md +++ b/packages/vant/docs/markdown/use-custom-field-value.zh-CN.md @@ -16,12 +16,17 @@ ```js // MyComponent.vue +import { ref } from 'vue'; import { useCustomFieldValue } from '@vant/use'; export default { setup() { + const myValue = ref(0); + // 此处传入的值会替代 Field 组件内部的 value - useCustomFieldValue(() => 'Some value'); + useCustomFieldValue(() => myValue.value); + + return { myValue }; }, }; ```