Skip to content

Commit

Permalink
docs(input): optimize docs (#1705)
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji authored Jul 11, 2024
1 parent 73a1a3e commit 5a5eaf3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 38 deletions.
22 changes: 5 additions & 17 deletions packages/varlet-ui/src/input/docs/en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const value9 = ref('')
const value10 = ref('')
const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input placeholder="Please enter text" v-model="value" />
<var-input placeholder="Please enter number" type="number" v-model="value13" />
<var-input placeholder="Readonly" readonly v-model="value2" />
<var-input placeholder="Disabled" disabled v-model="value3" />
<var-input placeholder="Clearable" clearable v-model="value4" />
Expand Down Expand Up @@ -92,11 +94,13 @@ const value9 = ref('')
const value10 = ref('')
const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input variant="outlined" placeholder="Please enter text" v-model="value" />
<var-input variant="outlined" placeholder="Please enter number" type="number" v-model="value13" />
<var-input variant="outlined" placeholder="Readonly" readonly v-model="value2" />
<var-input variant="outlined" placeholder="Disabled" disabled v-model="value3" />
<var-input variant="outlined" placeholder="Clearable" clearable v-model="value4" />
Expand Down Expand Up @@ -149,22 +153,6 @@ const value12 = ref('')
</style>
```

### Number point keyboard

```html
<script setup>
import { ref } from 'vue'
const value = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input variant="outlined" placeholder="number point keyboard" type="decimal" v-model="value" />
</var-space>
</template>
```

## API

### Props
Expand All @@ -173,7 +161,7 @@ const value = ref('')
| --- |----------------------------------------------------------------------------------------------------------------------------------------| --- | --- |
| `v-model` | The value of the binding | _string_ | `-` |
| `placeholder` | placeholder | _string_ | `-` |
| `type` | Input type, The optional value is `text` `password` `number` `tel` `decimal` | _string_ | `text` |
| `type` | Input type, The optional value is `text` `password` `number` `tel` | _string_ | `text` |
| `size` | Input size, The optional value is `normal` `small` | _string_ | `normal` |
| `variant` | Input variants, The optional value is `standard` `outlined` | _string_ | `standard` |
| `maxlength` | Maxlength | _string \| number_ | `-` |
Expand Down
22 changes: 5 additions & 17 deletions packages/varlet-ui/src/input/docs/zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const value9 = ref('')
const value10 = ref('')
const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input placeholder="请输入文本" v-model="value" />
<var-input placeholder="请输入数字" type="number" v-model="value13" />
<var-input placeholder="只读" readonly v-model="value2" />
<var-input placeholder="禁用" disabled v-model="value3" />
<var-input placeholder="可清除" clearable v-model="value4" />
Expand Down Expand Up @@ -92,11 +94,13 @@ const value9 = ref('')
const value10 = ref('')
const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input variant="outlined" placeholder="请输入文本" v-model="value" />
<var-input variant="outlined" placeholder="请输入数字" type="number" v-model="value13" />
<var-input variant="outlined" placeholder="只读" readonly v-model="value2" />
<var-input variant="outlined" placeholder="禁用" disabled v-model="value3" />
<var-input variant="outlined" placeholder="可清除" clearable v-model="value4" />
Expand Down Expand Up @@ -149,22 +153,6 @@ const value12 = ref('')
</style>
```

### 小数点键盘

```html
<script setup>
import { ref } from 'vue'
const value = ref('')
</script>

<template>
<var-space direction="column" size="large">
<var-input variant="outlined" placeholder="小数点键盘" type="decimal" v-model="value" />
</var-space>
</template>
```

## API

### 属性
Expand All @@ -173,7 +161,7 @@ const value = ref('')
| --- |--------------------------------------------------------------------------| --- | --- |
| `v-model` | 绑定的值 | _string_ | `-` |
| `placeholder` | 占位符 | _string_ | `-` |
| `type` | 输入框类型, 可选值为 `text` `password` `number` `tel` `decimal` | _string_ | `text` |
| `type` | 输入框类型, 可选值为 `text` `password` `number` `tel` | _string_ | `text` |
| `size` | 输入框尺寸,可选值 `normal` `small` | _string_ | `normal` |
| `variant` | 输入框风格, 可选值为 `standard` `outlined` | _string_ | `standard` |
| `maxlength` | 最大长度 | _string \| number_ | `-` |
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/input/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const standardValue9 = ref('')
const standardValue10 = ref('')
const standardValue11 = ref('')
const standardValue12 = ref('')
const standardValue13 = ref('')
const outlinedValue = ref('')
const outlinedValue2 = ref('')
Expand All @@ -28,6 +29,7 @@ const outlinedValue9 = ref('')
const outlinedValue10 = ref('')
const outlinedValue11 = ref('')
const outlinedValue12 = ref('')
const outlinedValue13 = ref('')
watchLang(use)
onThemeChange()
Expand All @@ -37,8 +39,7 @@ onThemeChange()
<app-type>{{ t('standard') }}</app-type>
<var-space direction="column" :size="['3vmin', 0]">
<var-input :placeholder="t('placeholder')" v-model="standardValue" />
<var-input :placeholder="t('numberPlaceholder')" type="number" v-model="standardValue" />
<var-input :placeholder="t('floatPlaceholder')" type="decimal" v-model="standardValue" />
<var-input :placeholder="t('numberPlaceholder')" type="number" v-model="standardValue13" />
<var-input :placeholder="t('readonly')" readonly v-model="standardValue2" />
<var-input :placeholder="t('disabled')" disabled v-model="standardValue3" />
<var-input :placeholder="t('clearable')" clearable v-model="standardValue4" />
Expand Down Expand Up @@ -78,6 +79,7 @@ onThemeChange()
<app-type style="margin-top: 10vmin">{{ t('outlined') }}</app-type>
<var-space direction="column" :size="['6vmin', 0]">
<var-input variant="outlined" :placeholder="t('placeholder')" v-model="outlinedValue" />
<var-input variant="outlined" :placeholder="t('numberPlaceholder')" type="number" v-model="outlinedValue13" />
<var-input variant="outlined" :placeholder="t('readonly')" readonly v-model="outlinedValue2" />
<var-input variant="outlined" :placeholder="t('disabled')" disabled v-model="outlinedValue3" />
<var-input variant="outlined" :placeholder="t('clearable')" clearable v-model="outlinedValue4" />
Expand Down
1 change: 0 additions & 1 deletion packages/varlet-ui/src/input/example/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default {
validate: 'Validate',
placeholder: 'Please enter text',
numberPlaceholder: 'Please enter number',
floatPlaceholder: 'Please enter float number',
maxMessage: 'Text length must be greater than 6',
clearableText: 'Clearable Text',
}
1 change: 0 additions & 1 deletion packages/varlet-ui/src/input/example/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default {
validate: '字段校验',
placeholder: '请输入文本',
numberPlaceholder: '请输入数字',
floatPlaceholder: '请输入小数',
maxMessage: '文本长度必须大于6',
clearableText: '可清除文本',
}

0 comments on commit 5a5eaf3

Please sign in to comment.