Skip to content

Conversation

@RylanBot
Copy link
Collaborator

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

测试代码存档(直接点击「提交」报错)
import React from 'react';
import type { FormProps } from 'tdesign-react';
import { Button, Form, Input, MessagePlugin } from 'tdesign-react';

const { FormItem } = Form;

export default function BaseForm() {
  const [form] = Form.useForm();

  const onSubmit: FormProps['onSubmit'] = (e) => {
    console.log(e);
    if (e.validateResult === true) {
      MessagePlugin.info('提交成功');
    }
  };

  return (
    <Form form={form} onSubmit={onSubmit}>
      <FormItem
        label="密码"
        name="password"
        rules={[
          {
            required: true,
          },
          {
            validator: (value) => value?.includes('123'),
            trigger: 'change',
            message: '密码必须包含123',
          },
        ]}
      >
        <Input />
      </FormItem>
      <FormItem style={{ marginLeft: 100 }}>
        <Button type="submit" theme="primary">
          提交
        </Button>
      </FormItem>
    </Form>
  );
}

📝 更新日志

  • 本条 PR 不需要纳入 Changelog

tdesign-react

  • fix(Form): 修复自定义 rules 时,读取到 undefined 产生的报错问题

@tdesign-react/chat

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

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

@tdesign-bot
Copy link
Collaborator

tdesign-bot commented Jan 12, 2026

TDesign Component Site Preview Open

Component Preview
tdesign-react 完成
@tdesign-react/chat 完成

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

  • tdesign-react-demo

    npm i https://pkg.pr.new/Tencent/tdesign-react@4079
    
    npm i https://pkg.pr.new/Tencent/tdesign-react/@tdesign-react/chat@4079
    

commit: f40ecf6

// 仅有自定义校验方法才会存在 successList
result.successList = result.resultList.filter(
(item) => item.result === true && item.message && item.type === 'success',
(item) => item && item.result === true && item.message && item.type === 'success',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么一个补充的是 optional? 一个补充又是的 item &&

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

Successfully merging this pull request may close these issues.

4 participants