Skip to content

Fixform item #6401

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

Closed
wants to merge 2 commits into from
Closed

Fixform item #6401

wants to merge 2 commits into from

Conversation

chenxiaofie
Copy link

首先,感谢你的贡献! 😄

新特性请提交至 feature 分支,其余可提交至 master 分支。在一个维护者审核通过后合并。请确保填写以下 pull request 的信息,谢谢!~

[English Template / 英文模板]

这个变动的性质是

  • [] 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 组件样式改进
  • TypeScript 定义更新
  • 重构
  • 代码风格优化
  • 分支合并
  • 其他改动(是关于什么的改动?)

需求背景

  1. formItem 没有 disabled 属性,碰到需要 disabled 的场景只能去 formitem 里 disabled 对应的表单组件
  • formitem 不支持 disabled 属性
  1. https://github.com/vueComponent/ant-design-vue/issues/6374。

实现方案和 API(非新功能可选)

  • formItem 去获取 slots Node 的 props,判断有没有 disabled,去修改表单校验时候的逻辑,不需要处理 child node

    但是这种情况下 child node 有可能是 div 不会设置 disabled 或者其他 props,那么就需要进行遍历获取 child node 的 disabled 的属性,同时不确定的情况太多,因为一个 formitem 有可能 input 会有多个,而且有可能会出现一个需要 disabled 一个不需要 disabled 的情况。
  • formitem 组件新增一个 disabled 属性,child node 继承这个 disabled 属性,disabled 控制的样式由 child node 自己决定,但是也会和上面出现一样额情况
  • formitem 组件新增一个 disabled 属性,同时新增一个 disabled 遮罩 dom,在校验的时候判断 disabled 是否存在,存在则跳过校验。
  <a-form-item
      disabled
      :rules="[{ required: true, message: 'Please input your username!' }]"
    >
      <a-input v-model:value="formState.username" />
    </a-form-item>
  1. 20230328172254.webm

对用户的影响和可能的风险(非新功能可选)

  1. 无影响
  2. 不包含

Changelog 描述(非新功能可选)

  1. FormItem Add new prop disabled
  2. formitem 组件新增 disable 属性

请求合并前的自查清单

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

后续计划(非新功能可选)

如果这个提交后面还有相关的其他提交和跟进信息,可以写在这里。

@tangjinzhou
Copy link
Member

这个在 3.3 里面已经有类似功能了

@chenxiaofie chenxiaofie closed this Apr 6, 2023
@six5nine
Copy link

six5nine commented Sep 4, 2023

这个在 3.3 里面已经有类似功能了
大神 4.1.0 form-item slot label 不能用了吗? 我看extra 可以生效, 看了你源码所有的测试案列好像都没有插槽类目
<template #label>

xxxx
</

Copy link

github-actions bot commented Sep 4, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants