From e46e07adefd6e1f4d52aeb0d83c12d9fbdc51a00 Mon Sep 17 00:00:00 2001 From: Eiinu Date: Wed, 17 Jan 2024 22:41:26 +0800 Subject: [PATCH] chore(input): split demo (#2850) --- .../src/dentry/pages/input/align.vue | 11 + .../src/dentry/pages/input/basic.vue | 7 + .../src/dentry/pages/input/border.vue | 9 + .../src/dentry/pages/input/clear.vue | 17 ++ .../src/dentry/pages/input/count.vue | 7 + .../src/dentry/pages/input/event.vue | 13 + .../src/dentry/pages/input/form.vue | 11 + .../src/dentry/pages/input/format.vue | 10 + .../src/dentry/pages/input/index.vue | 187 +++++---------- .../src/dentry/pages/input/slot.vue | 15 ++ .../src/dentry/pages/input/status.vue | 9 + .../src/dentry/pages/input/type.vue | 13 + src/packages/__VUE/input/demo.vue | 211 ---------------- src/packages/__VUE/input/demo/align.vue | 11 + src/packages/__VUE/input/demo/basic.vue | 7 + src/packages/__VUE/input/demo/border.vue | 9 + src/packages/__VUE/input/demo/clear.vue | 17 ++ src/packages/__VUE/input/demo/count.vue | 7 + src/packages/__VUE/input/demo/event.vue | 13 + src/packages/__VUE/input/demo/form.vue | 11 + src/packages/__VUE/input/demo/format.vue | 10 + src/packages/__VUE/input/demo/index.vue | 80 +++++++ src/packages/__VUE/input/demo/slot.vue | 15 ++ src/packages/__VUE/input/demo/status.vue | 9 + src/packages/__VUE/input/demo/type.vue | 13 + src/packages/__VUE/input/doc.en-US.md | 206 ++-------------- src/packages/__VUE/input/doc.md | 217 ++--------------- src/packages/__VUE/input/doc.taro.md | 226 ++---------------- 28 files changed, 446 insertions(+), 925 deletions(-) create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/align.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/basic.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/border.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/clear.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/count.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/event.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/form.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/format.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/slot.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/status.vue create mode 100644 packages/nutui-taro-demo/src/dentry/pages/input/type.vue delete mode 100644 src/packages/__VUE/input/demo.vue create mode 100644 src/packages/__VUE/input/demo/align.vue create mode 100644 src/packages/__VUE/input/demo/basic.vue create mode 100644 src/packages/__VUE/input/demo/border.vue create mode 100644 src/packages/__VUE/input/demo/clear.vue create mode 100644 src/packages/__VUE/input/demo/count.vue create mode 100644 src/packages/__VUE/input/demo/event.vue create mode 100644 src/packages/__VUE/input/demo/form.vue create mode 100644 src/packages/__VUE/input/demo/format.vue create mode 100644 src/packages/__VUE/input/demo/index.vue create mode 100644 src/packages/__VUE/input/demo/slot.vue create mode 100644 src/packages/__VUE/input/demo/status.vue create mode 100644 src/packages/__VUE/input/demo/type.vue diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/align.vue b/packages/nutui-taro-demo/src/dentry/pages/input/align.vue new file mode 100644 index 0000000000..64b3e94b40 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/align.vue @@ -0,0 +1,11 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/basic.vue b/packages/nutui-taro-demo/src/dentry/pages/input/basic.vue new file mode 100644 index 0000000000..23bb98f67b --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/basic.vue @@ -0,0 +1,7 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/border.vue b/packages/nutui-taro-demo/src/dentry/pages/input/border.vue new file mode 100644 index 0000000000..e200ac25f9 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/border.vue @@ -0,0 +1,9 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/clear.vue b/packages/nutui-taro-demo/src/dentry/pages/input/clear.vue new file mode 100644 index 0000000000..d763ecfce1 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/clear.vue @@ -0,0 +1,17 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/count.vue b/packages/nutui-taro-demo/src/dentry/pages/input/count.vue new file mode 100644 index 0000000000..0415602cf3 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/count.vue @@ -0,0 +1,7 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/event.vue b/packages/nutui-taro-demo/src/dentry/pages/input/event.vue new file mode 100644 index 0000000000..1a7cf22548 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/event.vue @@ -0,0 +1,13 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/form.vue b/packages/nutui-taro-demo/src/dentry/pages/input/form.vue new file mode 100644 index 0000000000..4161e23e96 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/form.vue @@ -0,0 +1,11 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/format.vue b/packages/nutui-taro-demo/src/dentry/pages/input/format.vue new file mode 100644 index 0000000000..bab0b02232 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/format.vue @@ -0,0 +1,10 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/index.vue b/packages/nutui-taro-demo/src/dentry/pages/input/index.vue index 1418921492..acb8745621 100644 --- a/packages/nutui-taro-demo/src/dentry/pages/input/index.vue +++ b/packages/nutui-taro-demo/src/dentry/pages/input/index.vue @@ -1,139 +1,80 @@ - - diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/slot.vue b/packages/nutui-taro-demo/src/dentry/pages/input/slot.vue new file mode 100644 index 0000000000..820a233816 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/slot.vue @@ -0,0 +1,15 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/status.vue b/packages/nutui-taro-demo/src/dentry/pages/input/status.vue new file mode 100644 index 0000000000..57afa69ad9 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/status.vue @@ -0,0 +1,9 @@ + + diff --git a/packages/nutui-taro-demo/src/dentry/pages/input/type.vue b/packages/nutui-taro-demo/src/dentry/pages/input/type.vue new file mode 100644 index 0000000000..6ade630d17 --- /dev/null +++ b/packages/nutui-taro-demo/src/dentry/pages/input/type.vue @@ -0,0 +1,13 @@ + + diff --git a/src/packages/__VUE/input/demo.vue b/src/packages/__VUE/input/demo.vue deleted file mode 100644 index bc68c10159..0000000000 --- a/src/packages/__VUE/input/demo.vue +++ /dev/null @@ -1,211 +0,0 @@ - - - - - diff --git a/src/packages/__VUE/input/demo/align.vue b/src/packages/__VUE/input/demo/align.vue new file mode 100644 index 0000000000..64b3e94b40 --- /dev/null +++ b/src/packages/__VUE/input/demo/align.vue @@ -0,0 +1,11 @@ + + diff --git a/src/packages/__VUE/input/demo/basic.vue b/src/packages/__VUE/input/demo/basic.vue new file mode 100644 index 0000000000..23bb98f67b --- /dev/null +++ b/src/packages/__VUE/input/demo/basic.vue @@ -0,0 +1,7 @@ + + diff --git a/src/packages/__VUE/input/demo/border.vue b/src/packages/__VUE/input/demo/border.vue new file mode 100644 index 0000000000..e200ac25f9 --- /dev/null +++ b/src/packages/__VUE/input/demo/border.vue @@ -0,0 +1,9 @@ + + diff --git a/src/packages/__VUE/input/demo/clear.vue b/src/packages/__VUE/input/demo/clear.vue new file mode 100644 index 0000000000..1ff59dcc4b --- /dev/null +++ b/src/packages/__VUE/input/demo/clear.vue @@ -0,0 +1,17 @@ + + diff --git a/src/packages/__VUE/input/demo/count.vue b/src/packages/__VUE/input/demo/count.vue new file mode 100644 index 0000000000..0415602cf3 --- /dev/null +++ b/src/packages/__VUE/input/demo/count.vue @@ -0,0 +1,7 @@ + + diff --git a/src/packages/__VUE/input/demo/event.vue b/src/packages/__VUE/input/demo/event.vue new file mode 100644 index 0000000000..1a7cf22548 --- /dev/null +++ b/src/packages/__VUE/input/demo/event.vue @@ -0,0 +1,13 @@ + + diff --git a/src/packages/__VUE/input/demo/form.vue b/src/packages/__VUE/input/demo/form.vue new file mode 100644 index 0000000000..4161e23e96 --- /dev/null +++ b/src/packages/__VUE/input/demo/form.vue @@ -0,0 +1,11 @@ + + diff --git a/src/packages/__VUE/input/demo/format.vue b/src/packages/__VUE/input/demo/format.vue new file mode 100644 index 0000000000..bab0b02232 --- /dev/null +++ b/src/packages/__VUE/input/demo/format.vue @@ -0,0 +1,10 @@ + + diff --git a/src/packages/__VUE/input/demo/index.vue b/src/packages/__VUE/input/demo/index.vue new file mode 100644 index 0000000000..0a49da442b --- /dev/null +++ b/src/packages/__VUE/input/demo/index.vue @@ -0,0 +1,80 @@ + + + diff --git a/src/packages/__VUE/input/demo/slot.vue b/src/packages/__VUE/input/demo/slot.vue new file mode 100644 index 0000000000..2e21e214ff --- /dev/null +++ b/src/packages/__VUE/input/demo/slot.vue @@ -0,0 +1,15 @@ + + diff --git a/src/packages/__VUE/input/demo/status.vue b/src/packages/__VUE/input/demo/status.vue new file mode 100644 index 0000000000..57afa69ad9 --- /dev/null +++ b/src/packages/__VUE/input/demo/status.vue @@ -0,0 +1,9 @@ + + diff --git a/src/packages/__VUE/input/demo/type.vue b/src/packages/__VUE/input/demo/type.vue new file mode 100644 index 0000000000..fd8c709d96 --- /dev/null +++ b/src/packages/__VUE/input/demo/type.vue @@ -0,0 +1,13 @@ + + diff --git a/src/packages/__VUE/input/doc.en-US.md b/src/packages/__VUE/input/doc.en-US.md index a68ae10cbd..5f26905103 100644 --- a/src/packages/__VUE/input/doc.en-US.md +++ b/src/packages/__VUE/input/doc.en-US.md @@ -18,233 +18,55 @@ app.use(Input); The value of field is bound with `v-model`. -:::demo - -```vue - - -``` - -::: +> demo: input basic ### Custom Type -Use `type` prop to custom different type fields. - -:::demo - -```vue - - -``` - -::: +> demo: input type ### Readonly And Disabled -Use `readonly` to set the input box to read-only status, and use `disabled` to set the input box to disabled status. - -:::demo - -```vue - - -``` - -::: +> demo: input status ### Show Clear Icon Display the clear icon during input by setting 'clearable'. The clear button will be hidden after losing focus. You can set the clear button to continue to display after losing focus through 'showClearIcon'. -:::demo - -```vue - - -``` - -::: +> demo: input clear ### Use With Form Use in combination with `nut-form` and `nut-form-item` -:::demo - -```vue - - -``` - -::: +> demo: input form ### Format Value Use `formatter` prop to format the input value. -:::demo - -```vue - - -``` - -::: +> demo: input format ### Show Word Limit After setting the `maxlength` and `show-word-limit` attributes, word count will be displayed at the bottom. -:::demo - -```vue - - -``` - -::: +> demo: input count ### No Border -:::demo - -```vue - - -``` +> demo: input border -::: - -### Event Demo - -:::demo - -```vue - - -``` +### Input Align -::: +> demo: input align -### Slots Demo +### Event -:::demo +> demo: input event -```vue - - -``` +### Slot -::: +> demo: input slot ## API diff --git a/src/packages/__VUE/input/doc.md b/src/packages/__VUE/input/doc.md index b54db3323f..29dbcde38f 100644 --- a/src/packages/__VUE/input/doc.md +++ b/src/packages/__VUE/input/doc.md @@ -18,240 +18,67 @@ app.use(Input); 可以通过 `v-model` 双向绑定输入框的值,通过 `placeholder` 设置占位提示文字。 -:::demo - -```vue - - -``` - -::: +> demo: input basic ### 自定义类型 -根据 `type` 属性定义不同类型的输入框,默认值为 `text`。 - -:::demo - -```vue - - -``` +- `text`: 默认值,文本类型 +- `password`: 密码类型 +- `number`: 数字类型,支持小数 +- `digit`: 整数类型 -::: +> demo: input type ### 禁用和只读 -通过 `readonly` 将输入框设置为只读状态,通过 `disabled` 将输入框设置为禁用状态。 - -:::demo - -```vue - - -``` +- `readonly`: 只读状态 +- `disabled`: 禁用状态 -::: +> demo: input status ### 显示清除图标 -通过设置 `clearable` 在输入过程中展示清除图标。清除按钮,在失去焦点后将隐藏,可通过 `showClearIcon` 设置失去焦点后继续展示清除按钮。 - -:::demo - -```vue - - -``` +开启 `clearable` 后,在输入过程中会展示清除图标,在失去焦点后将隐藏。 -::: +开启 `show-clear-icon` 后,失去焦点时仍会继续展示清除按钮。 + +> demo: input clear ### 配合表单使用 结合 `nut-form` 与 `nut-form-item` 使用 -:::demo - -```vue - - -``` - -::: +> demo: input form ### 格式化输入内容 通过 `formatter` 属性可以对输入的内容进行格式化,通过 `format-trigger` 属性可以指定执行格式化的时机。例如只允许输入非数字的字符: -:::demo - -```vue - - -``` - -::: +> demo: input format ### 显示字数统计 设置 `maxlength` 和 `show-word-limit` 属性后会在底部显示字数统计。 -:::demo - -```vue - - -``` - -::: +> demo: input count ### 无边框 通过 `border` 属性可以设置输入框的边框。 -:::demo - -```vue - - -``` +> demo: input border -::: +### 对齐方式 -### 事件演示 +> demo: input border -:::demo - -```vue - - -``` +### 事件演示 -::: +> demo: input event ### 插槽演示 -:::demo - -```vue - - -``` - -::: +> demo: input slot ## API diff --git a/src/packages/__VUE/input/doc.taro.md b/src/packages/__VUE/input/doc.taro.md index 061129fa6c..1b29226919 100644 --- a/src/packages/__VUE/input/doc.taro.md +++ b/src/packages/__VUE/input/doc.taro.md @@ -18,253 +18,71 @@ app.use(Input); 可以通过 `v-model` 双向绑定输入框的值,通过 `placeholder` 设置占位提示文字。 -:::demo - -```vue - - -``` - -::: +> demo: input basic dentry ### 自定义类型 -根据 `type` 属性定义不同类型的输入框,默认值为 `text`。 - > NutUI < 4.2.0 时,number 类型为小数,digit 类型为整数。 > > NutUI >= 4.2.0 时,调整为与小程序原生 input 的类型字段保持一致(如下示例),同时支持调用原生整数键盘、带小数点键盘。 -:::demo - -```vue - - -``` +- `text`: 默认值,文本类型 +- `password`: 密码类型 +- `digit`: 数字类型,支持小数 +- `number`: 整数类型 -::: +> demo: input type dentry ### 禁用和只读 -通过 `readonly` 将输入框设置为只读状态,通过 `disabled` 将输入框设置为禁用状态。 - -:::demo - -```vue - - -``` +- `readonly`: 只读状态 +- `disabled`: 禁用状态 -::: +> demo: input status dentry ### 显示清除图标 -通过设置 `clearable` 在输入过程中展示清除图标。清除按钮,在失去焦点后将隐藏,可通过 `showClearIcon` 设置失去焦点后继续展示清除按钮。 - -:::demo - -```vue - - -``` +开启 `clearable` 后,在输入过程中会展示清除图标,在失去焦点后将隐藏。 + +开启 `show-clear-icon` 后,失去焦点时仍会继续展示清除按钮。 -::: +> demo: input clear dentry ### 配合表单使用 结合 `nut-form` 与 `nut-form-item` 使用 -:::demo - -```vue - - -``` - -::: +> demo: input form dentry ### 格式化输入内容 通过 `formatter` 属性可以对输入的内容进行格式化,通过 `format-trigger` 属性可以指定执行格式化的时机。例如只允许输入非数字的字符: -:::demo - -```vue - - -``` - -::: +> demo: input format dentry ### 显示字数统计 设置 `maxlength` 和 `show-word-limit` 属性后会在底部显示字数统计。 -:::demo - -```vue - - -``` - -::: +> demo: input count dentry ### 无边框 通过 `border` 属性可以设置输入框的边框。 -:::demo - -```vue - - -``` +> demo: input border dentry -::: +### 对齐方式 -### 事件演示 +> demo: input border dentry -:::demo - -```vue - - -``` +### 事件演示 -::: +> demo: input event dentry ### 插槽演示 -:::demo - -```vue - - -``` - -::: +> demo: input slot dentry ## API