Skip to content
New issue

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

需要在某些情况下禁用输入组件被Form注入error状态 #3271

Open
1 task done
ccf-zeno opened this issue Aug 20, 2024 · 1 comment
Open
1 task done

需要在某些情况下禁用输入组件被Form注入error状态 #3271

ccf-zeno opened this issue Aug 20, 2024 · 1 comment

Comments

@ccf-zeno
Copy link

ccf-zeno commented Aug 20, 2024

基本信息

  • 依赖包名 及 版本: @arco-design/[email protected]
  • 浏览器版本: chrome127.0.0.0

复现步骤

有时需要封装一些复杂的表单控件,比如我这个控件里面有一个搜索框,会搜索部分数据。如果该FormItem校验错误,会给该搜索框Input注入error的状态,这显然是不合理的,需要关闭这个搜索框的error状态

image
@shaonq
Copy link

shaonq commented Aug 23, 2024

<template>
  <div><slot /></div>
</template>

<script lang="ts" setup>
  import { provide, inject } from 'vue';
  import { formItemInjectionKey } from '@arco-design/web-vue/es/form/context';

  provide(formItemInjectionKey, { ...inject(formItemInjectionKey), error: false });
</script>
  • 新建一个空白组件,套在a-input外面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants