Skip to content

Commit

Permalink
docs(form): [form] optimize demo and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gimmyhehe committed Oct 25, 2024
1 parent c363512 commit 26320c3
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tiny-form-item label="邮件" prop="email">
<tiny-input v-model="createData.email"></tiny-input>
</tiny-form-item>
<tiny-form-item label="Numeric字段" prop="num1">
<tiny-form-item label="数字" prop="num1">
<tiny-numeric v-model="createData.num1"></tiny-numeric>
</tiny-form-item>
<tiny-form-item label="IP字段" prop="ip">
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/form/form-validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tiny-form-item label="邮件" prop="email">
<tiny-input v-model="createData.email"></tiny-input>
</tiny-form-item>
<tiny-form-item label="Numeric字段" prop="num1">
<tiny-form-item label="数字" prop="num1">
<tiny-numeric v-model="createData.num1"></tiny-numeric>
</tiny-form-item>
<tiny-form-item label="IP字段" prop="ip">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="title">
标签位置: <tiny-button-group :data="labelPositionList" v-model="labelPositionValue"></tiny-button-group>
</div>
<tiny-form ref="ruleFormRef" :model="createData" :label-position="labelPositionValue" label-width="60px">
<tiny-form ref="ruleFormRef" :model="createData" :label-position="labelPositionValue">
<tiny-form-item label="用户名" prop="username">
<tiny-input v-model="createData.username"></tiny-input>
</tiny-form-item>
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/form/label-position.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="title">
标签位置: <tiny-button-group :data="labelPositionList" v-model="labelPositionValue"></tiny-button-group>
</div>
<tiny-form ref="ruleFormRef" :model="createData" :label-position="labelPositionValue" label-width="60px">
<tiny-form ref="ruleFormRef" :model="createData" :label-position="labelPositionValue">
<tiny-form-item label="用户名" prop="username">
<tiny-input v-model="createData.username"></tiny-input>
</tiny-form-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ function submitClick() {

<style scoped>
.demo-form {
width: 380px;
width: 420px;
}
.scroll-parent {
height: 200px;
overflow: auto;
padding-right: 40px;
}
</style>
3 changes: 2 additions & 1 deletion examples/sites/demos/pc/app/form/popper-options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ export default {

<style scoped>
.demo-form {
width: 380px;
width: 420px;
}
.scroll-parent {
height: 200px;
overflow: auto;
padding-right: 40px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="demo-form">
<tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px" show-message>
<tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px">
<tiny-form-item prop="users">
<template #label> 必填 </template>
<tiny-input v-model="createData.users"></tiny-input>
Expand All @@ -11,7 +11,7 @@
</tiny-form-item>
<tiny-form-item prop="url">
<template #label>
<div class="custom-label">超过两行文字,省略显示</div>
<div class="custom-label" v-auto-tip>超过两行文字,省略显示</div>
</template>
<tiny-input v-model="createData.url"></tiny-input>
</tiny-form-item>
Expand All @@ -37,6 +37,7 @@ import {
Modal,
RadioGroup as TinyRadioGroup
} from '@opentiny/vue'
import { AutoTip as VAutoTip } from '@opentiny/vue-directive'
function handleClick() {
Modal.message({ message: 'click', status: 'info' })
Expand Down
6 changes: 4 additions & 2 deletions examples/sites/demos/pc/app/form/slot-label.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="demo-form">
<tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px" show-message>
<tiny-form ref="ruleFormRef" :model="createData" :rules="rules" label-width="100px">
<tiny-form-item prop="users">
<template #label> 必填 </template>
<tiny-input v-model="createData.users"></tiny-input>
Expand All @@ -11,7 +11,7 @@
</tiny-form-item>
<tiny-form-item prop="url">
<template #label>
<div class="custom-label">超过两行文字,省略显示</div>
<div class="custom-label" v-auto-tip>超过两行文字,省略显示</div>
</template>
<tiny-input v-model="createData.url"></tiny-input>
</tiny-form-item>
Expand All @@ -28,6 +28,7 @@

<script>
import { Form, FormItem, Input, DatePicker, Button, Modal, RadioGroup } from '@opentiny/vue'
import { AutoTip } from '@opentiny/vue-directive'
export default {
components: {
Expand All @@ -38,6 +39,7 @@ export default {
TinyButton: Button,
TinyRadioGroup: RadioGroup
},
directives: { AutoTip },
data() {
return {
options: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:hide-required-asterisk="hideRequiredAsterisk"
:model="createData"
:rules="rules"
label-width="100px"
label-width="108px"
validate-type="text"
message-type="block"
>
Expand All @@ -36,7 +36,6 @@ import {
FormItem as TinyFormItem,
Input as TinyInput,
Button as TinyButton,
Modal,
Switch as TinySwitch
} from '@opentiny/vue'
Expand All @@ -59,6 +58,7 @@ function handleSubmit() {
})
}
</script>

<style scoped>
.demo-form {
width: 380px;
Expand Down
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/form/smb-required.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:hide-required-asterisk="hideRequiredAsterisk"
:model="createData"
:rules="rules"
label-width="100px"
label-width="108px"
validate-type="text"
message-type="block"
>
Expand All @@ -30,7 +30,7 @@
</template>

<script>
import { Form, FormItem, Input, Button, Modal, Switch } from '@opentiny/vue'
import { Form, FormItem, Input, Button, Switch } from '@opentiny/vue'
export default {
components: {
Expand Down
8 changes: 4 additions & 4 deletions examples/sites/demos/pc/app/form/webdoc/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,21 @@ export default {
},
desc: {
'zh-CN':
'<p>通过 <code>hide-required-asterisk</code> 设置是否隐藏标签前的红色星号,默认为 <code>false</code> ,但SMB主题下,默认为 <code>true</code> 。</p>',
'<p>通过 <code>hide-required-asterisk</code> 设置是否隐藏标签前的红色星号,默认为 <code>true</code> 。</p>',
'en-US':
'By setting whether to hide the red asterisk in front of the label through <code>hide required asterisk</code> , it defaults to <code>false</code> , but under the SMB theme, it defaults to <code>true</code> .'
'By setting whether to hide the red asterisk in front of the label through <code>hide required asterisk</code> , it defaults to <code>true</code>.'
},
codeFiles: ['smb-required.vue']
},
{
demoId: 'popper-options',
name: {
'zh-CN': '错误提示',
'zh-CN': '错误提示跟随页面',
'en-US': 'Error tip options'
},
desc: {
'zh-CN':
'<p>通过 <code>popper-options</code> 设置<code>tip</code>类型错误提示,例如:当表单父元素是滚动元素,切页面滚动后,提示会错位,将 <code>bubbling</code> 属性设置为 <code>true</code>可解决此问题。</p>',
'<p>通过 <code>popper-options</code> 设置<code>tip</code>类型错误提示,例如:当表单父元素是滚动元素,且页面滚动后,提示会错位,将 <code>bubbling</code> 属性设置为 <code>true</code>可解决此问题。</p>',
'en-US':
'Set the <code>tip</code> type error prompt through <code>popper-options</code>. For example, when the parent element of the form is a scrolling element and the page scrolls, the prompt will be misaligned. Change the <code>bubbling</code> attribute Set to <code>true</code> to resolve this issue.'
},
Expand Down

0 comments on commit 26320c3

Please sign in to comment.