Skip to content

Commit 8b13aa0

Browse files
SpikeMeowjevin98
authored andcommitted
!313 feat(formItem): 新增tips属性
* feat(component/formItem): formItem 增加一个 tips 属性,在表单的下方显示说明
1 parent 70efe9b commit 8b13aa0

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

docs/document-component/src/document/zh-CN/components/form.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
<template>
1616
<lay-form :model="model">
17-
<lay-form-item label="账户" prop="username">
17+
<lay-form-item label="账户" prop="username" tips="账户是您的登录凭据,可以在注册电子邮件中找到">
1818
<lay-input v-model="model.username"></lay-input>
1919
</lay-form-item>
20-
<lay-form-item label="密码" prop="password">
20+
<lay-form-item label="密码" prop="password" tips="密码应当包含字母、数字和特殊符号中的任意两种">
2121
<lay-input v-model="model.password" type="password"></lay-input>
2222
</lay-form-item>
2323
<lay-form-item label="描述" prop="desc">
@@ -919,6 +919,7 @@ const submit10 = function(isValidate, model, errors) {
919919
| error-message | 表单校验失败固定提示语 | `string` | -- | -- |
920920
| mode | 表单项显示的模式,`块元素` / `行元素` | `string` | `block` `inline` | `block` |
921921
| size | 尺寸 | -- | -- | -- |
922+
| tips | 表单项说明 | `string` | - | - |
922923
:::
923924

924925
::: title 表单项(form-item)方法

packages/component/src/component/form/index.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@
143143
.layui-form-item {
144144
margin-bottom: 20px;
145145
clear: both;
146+
147+
.layui-form-tips {
148+
color: #888;
149+
font-size: 14px;
150+
}
146151
}
147152

148153
.layui-form-item.inline {

packages/component/src/component/formItem/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ defineOptions({
2929
3030
const props = withDefaults(defineProps<FormItemProps>(), {
3131
// mode: "block",
32+
tips: "",
3233
});
3334
3435
export type FormItemProps = _FormItemProps;
@@ -286,6 +287,9 @@ const getMarginLeft = computed(() => {
286287
<div ref="slotParent">
287288
<slot :props="{ ...props, model: layForm.model }"></slot>
288289
</div>
290+
<span v-if="tips" class="layui-form-tips">
291+
{{ tips }}
292+
</span>
289293
<span
290294
v-if="errorStatus"
291295
:class="[

packages/component/src/component/formItem/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export interface FormItemProps {
1111
required?: boolean;
1212
requiredErrorMessage?: string;
1313
size?: string;
14+
tips?: string;
1415
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy