Skip to content

feat(Form): 添加表单组件及相关功能 - #3784

Closed
Jay2138 wants to merge 0 commit into
Tencent:developfrom
Jay2138:develop
Closed

feat(Form): 添加表单组件及相关功能#3784
Jay2138 wants to merge 0 commit into
Tencent:developfrom
Jay2138:develop

Conversation

@Jay2138

@Jay2138 Jay2138 commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

在 app.json 中添加表单页面路径
新增表单组件及表单项组件,支持数据录入和验证
更新文档,添加表单组件的 API 说明
添加表单示例,展示基本用法
优化样式和结构,提升组件可用性和可维护性

Comment thread example/pages/home/home.ts Outdated

path = `/pages/${name}/${this.skyline ? 'skyline/' : ''}${name}`;
}
console.log(path);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

去掉console

Comment thread src/common/style/var.less Outdated
@@ -0,0 +1 @@
@import './_variables.less';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

去掉冗余css

Comment thread src/form-item/props.ts Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

删除文件

Comment thread src/form/_example/form.js Outdated
@@ -0,0 +1,30 @@
Page({
data: {
isActive1: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

建议下次修改,使用语意化命名

Comment thread src/form/form.ts Outdated
`${prefix}-class-label`,
`${prefix}-class-controls`,
`${prefix}-class-help`,
`${prefix}-class-extra`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

移除无用外部样式类

Comment thread src/form/type.ts Outdated
* 表单底部按钮组样式
* @default {}
*/
buttonGroupStyle?: {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不要对外提供未在计划之内的API

Comment thread src/form/props.ts Outdated
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

tdesign-api 生成的内容建议不要手动修改,未完成的 API 可以协同 PMC 在=手动调整为【开发中】,但不要移除

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Form 需要补齐 disabled

@pkg-pr-new

pkg-pr-new Bot commented Jul 15, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/tdesign-miniprogram@3784

commit: a147acd

Comment thread src/form-item/form-item.less Outdated
}

&--bordered {
border-bottom: 1rpx solid @border-color;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

1rpx 不能直接达到 0.5px 效果。 0.5px 实现可直接使用 less Mixin
`&--bordered {
.border(bottom, @border-color);
}

Comment thread src/form-item/form-item.less Outdated
&__error {
margin-top: 4rpx;
font-size: @font-size-s;
line-height: 1.4;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

设计稿行高是 20px,20*1.4=16.8

Comment thread src/form-item/form-item.less Outdated
}

&__error {
margin-top: 4rpx;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

8rpx

Comment thread src/form/props.ts Outdated
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Form 需要补齐 disabled

Comment thread src/form-item/form-item-props.ts Outdated
* */

import { TdFormItemProps } from '../form/type';
const props: TdFormItemProps = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FormItem 补齐 arrow

Comment thread src/form/_example/form.wxml Outdated
<t-navbar class="block" title="Form" left-arrow />
<view class="demo">
<t-demo-header title="Form 表单" desc="用于收集输入信息。" notice="渲染框架支持情况:WebView" />
<t-demo title="基础表单" desc="">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

3 participants