Skip to content

Commit

Permalink
feat:新增TSelectIcon elemnt-plus图标选择组件
Browse files Browse the repository at this point in the history
  • Loading branch information
wocwin committed Sep 4, 2024
1 parent c451463 commit 1c54dfe
Show file tree
Hide file tree
Showing 12 changed files with 343 additions and 41 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import '@wocwin/t-ui-plus/lib/style.css'
| TCheckbox | [多选组件](https://wocwin.github.io/t-ui-plus/components/TCheckbox/base.html?_blank) |
| TChart | [图表组件](https://wocwin.github.io/t-ui-plus/components/TChart/base.html?_blank) |
| TTabs | [标签页组件](https://wocwin.github.io/t-ui-plus/components/TTabs/base.html?_blank) |
| TSelectIcon | [图标选择组件](https://wocwin.github.io/t-ui-plus/components/TSelectIcon/base.html?_blank) |


## Use CDN in Project(暂不支持)
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default defineConfig({
{ text: "多选框组组件", link: "/components/TCheckbox/base.md" },
{ text: "日期组件", link: "/components/TDatePicker/base.md" },
{ text: "Tabs组件", link: "/components/TTabs/base.md" },
{ text: "步骤组件", link: "/components/TStepWizard/base.md" }
{ text: "步骤组件", link: "/components/TStepWizard/base.md" },
{ text: "图标选择组件", link: "/components/TSelectIcon/base.md" },
]
},
{
Expand Down
76 changes: 38 additions & 38 deletions docs/components/TForm/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,44 +94,44 @@ TForm/isHideItem

### 2. 配置参数

| 参数 | 说明 | 类型 | 默认值 |
| :------------------ | :--------------------------------------------------------------------------------------------------------------- | :---------------- | :----- |
| className | 自定义类名 | String | - |
| labelPosition | 改变表单项 label 与输入框的布局方式(`right,left,top`) | String | '' |
| widthSize | 每行显示几个输入项(默认两项) 最大值 6 | Number | 2 |
| isTrim | 全局是否开启清除前后空格(comp 为 el-input 且 type 不等于'password') | Boolean | true |
| formOpts | 表单配置项 | Object | - |
| ---ref | 当前TForm实例 | Object | - |
| ---labelPosition | 改变表单项 label 与输入框的布局方式(默认:right) /top (优先展示组件`labelPosition`| String | right |
| ---listTypeInfo | 下拉选择数据源(type:'select'有效) | Object | - |
| ---fieldList | form 表单每项 list | Array | - |
| ------isHideItem | 某一项不显示 | Boolean | false |
| ------slotName | 自定义表单某一项输入框 | slot | - |
| ------childSlotName | 自定义表单某一下拉选择项子组件插槽(el-option) | slot | - |
| ------comp | 表单每一项组件名称(可使用第三方 UI 如 el-select/el-input 也可以使用自定义组件) | String/components | - |
| ------bind | 继承第三方 UI 的 Attributes,function 传出 formData | Object/funnction | - |
| ------isSelfCom | 是否使用自己封装的组件(即不需要嵌套 el-option 等) | Boolean | false |
| ------isTrim | 是否不清除前后空格(comp 为 el-input 且 type 不等于'password') | Boolean | false |
| ------type | 某一项类型(目前只有checkbox/radio/select-arr/select-obj)此值只有组件内嵌组件才设置(如:el-select内嵌el-option) | String | - |
| ------widthSize | form 表单某一项所占比例(如果占一整行则设置 1) | Number | - |
| ------width | form 表单某一项所占实际宽度 | String | - |
| ------arrLabel | type=select-arr 时,每个下拉显示的中文 | String | label |
| ------arrKey | type=select-arr 时,每个下拉显示的中文传后台的数字 | String | key |
| ------label | form 表单每一项 title | String | - |
| ------labelRender | 自定义某一项 title | function | - |
| ------labelSlotName | 自定义某一项 title(插槽名:就是 labelSlotName 值 | slot | - |
| ------value | form 表单每一项传给后台的参数 | String | - |
| ------rules | 每一项输入框的表单校验规则(可参考 element-plus el-form-item方式配置) | Object/Array | - |
| ------list | 下拉选择数据源(仅仅对 type:'select'有效) | String | - |
| ------event | 表单每一项事件标志(即是:handleEvent 事件第一个参数值) | String | - |
| ------eventHandle | 继承 comp 组件的事件 | Object | - |
| ------ref | 当前使用组件的 ref 标识(可以通过 getRefs 事件返回) | String | - |
| ---formData | 表单提交数据(对应 fieldList 每一项的 value 值) | Object | - |
| ---labelWidth | label 宽度 | String | 120px |
| ---rules | 校验规则(可参考 element-plus el-form 方式配置) | Object/Array | - |
| ---operatorList | 操作按钮 list | Array | - |
| -------bind | 继承 el-button 所有 Attributes(默认值{ type:'primary',size:'small',}) | Object | - |
| -------fun | 事件名 | function | - |
| 参数 | 说明 | 类型 | 默认值 |
| :------------------ | :--------------------------------------------------------------------------------------------------------------------------- | :---------------- | :----- |
| className | 自定义类名 | String | - |
| labelPosition | 改变表单项 label 与输入框的布局方式(`right,left,top`) | String | '' |
| widthSize | 每行显示几个输入项(默认两项) 最大值 6 | Number | 2 |
| isTrim | 全局是否开启清除前后空格(comp 为 el-input 且 type 不等于'password') | Boolean | true |
| formOpts | 表单配置项 | Object | - |
| ---ref | 当前TForm实例 | Object | - |
| ---labelPosition | 改变表单项 label 与输入框的布局方式(默认:right) /top (优先展示组件`labelPosition` | String | right |
| ---listTypeInfo | 下拉选择数据源(type:'select'有效) | Object | - |
| ---fieldList | form 表单每项 list | Array | - |
| ------isHideItem | 某一项不显示 | Boolean | false |
| ------slotName | 自定义表单某一项输入框 | slot | - |
| ------childSlotName | 自定义表单某一下拉选择项子组件插槽(el-option) | slot | - |
| ------comp | 表单每一项组件名称(可使用第三方 UI 如 el-select/el-input 也可以使用自定义组件) | String/components | - |
| ------bind | 继承第三方 UI 的 Attributes,function 传出 formData | Object/funnction | - |
| ------isSelfCom | 是否使用自己封装的组件(即不需要嵌套 el-option 等) | Boolean | false |
| ------isTrim | 是否不清除前后空格(comp 为 el-input 且 type 不等于'password') | Boolean | false |
| ------type | 某一项类型(目前只有checkbox/radio/select-arr/select-obj/inputNumber)此值只有组件内嵌组件才设置(如:el-select内嵌el-option) | String | - |
| ------widthSize | form 表单某一项所占比例(如果占一整行则设置 1) | Number | - |
| ------width | form 表单某一项所占实际宽度 | String | - |
| ------arrLabel | type=select-arr 时,每个下拉显示的中文 | String | label |
| ------arrKey | type=select-arr 时,每个下拉显示的中文传后台的数字 | String | key |
| ------label | form 表单每一项 title | String | - |
| ------labelRender | 自定义某一项 title | function | - |
| ------labelSlotName | 自定义某一项 title(插槽名:就是 labelSlotName 值 | slot | - |
| ------value | form 表单每一项传给后台的参数 | String | - |
| ------rules | 每一项输入框的表单校验规则(可参考 element-plus el-form-item方式配置) | Object/Array | - |
| ------list | 下拉选择数据源(仅仅对 type:'select'有效) | String | - |
| ------event | 表单每一项事件标志(即是:handleEvent 事件第一个参数值) | String | - |
| ------eventHandle | 继承 comp 组件的事件 | Object | - |
| ------ref | 当前使用组件的 ref 标识(可以通过 getRefs 事件返回) | String | - |
| ---formData | 表单提交数据(对应 fieldList 每一项的 value 值) | Object | - |
| ---labelWidth | label 宽度 | String | 120px |
| ---rules | 校验规则(可参考 element-plus el-form 方式配置) | Object/Array | - |
| ---operatorList | 操作按钮 list | Array | - |
| -------bind | 继承 el-button 所有 Attributes(默认值{ type:'primary',size:'small',}) | Object | - |
| -------fun | 事件名 | function | - |

### 3. events 继承 element-plus el-form 的 events

Expand Down
51 changes: 51 additions & 0 deletions docs/components/TSelectIcon/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# TSelectIcon elemnt-plus图标选择组件

### 基本使用

:::demo
TSelectIcon/base
:::

### 是否显示弹窗搜索框

:::demo
TSelectIcon/isShowSearch
:::

### 是否显示选中后的图标

:::demo
TSelectIcon/isShowIcon
:::

### selectBind属性配置

:::demo
TSelectIcon/selectBind
:::

### TSelectIcon Attributes

---

### 1、代码示例

```html
<t-select-icon v-model="selectVlaue" />
```

### 2、配置参数(Attributes)继承 el-input Attributes

| 参数 | 说明 | 类型 | 默认值 |
| :----------- | :------------------- | :--------- | :----------------------------------------------------------------------------------------------------------------- |
| v-model | 绑定值 | string | - |
| prefixIcon | 输入框前缀icon | string | Search |
| isShowSearch | 是否显示搜索图标 | Boolean | true |
| isShowIcon | 是否显示选中后的图标 | Boolean | true |
| selectBind | Attributes | selectBind | `"prefix-icon": props.prefixIcon, placeholder: "请选择图标",dialogTitle:'请选择图标',clearable: true,width: "50%"` |

### 3、事件(events)继承 el-input 属事件

| 事件名 | 说明 | 回调参数 |
| :----- | :--------- | :----------------- |
| select | 选择完图标 | 返回选中的图标name |
1 change: 1 addition & 0 deletions docs/components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import '@wocwin/t-ui-plus/lib/style.css'
| TCheckbox | [多选组件](https://wocwin.github.io/t-ui-plus/components/TCheckbox/base.html?_blank) |
| TChart | [图表组件](https://wocwin.github.io/t-ui-plus/components/TChart/base.html?_blank) |
| TTabs | [标签页组件](https://wocwin.github.io/t-ui-plus/components/TTabs/base.html?_blank) |
| TSelectIcon | [图标选择组件](https://wocwin.github.io/t-ui-plus/components/TSelectIcon/base.html?_blank) |

### T-ui-plus 组件 Volar 类型提示

Expand Down
14 changes: 14 additions & 0 deletions docs/examples/TSelectIcon/base.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<t-layout-page>
<t-layout-page-item>
<t-select-icon v-model="iconValue" @select="changeSelect" />
</t-layout-page-item>
</t-layout-page>
</template>
<script setup lang="ts">
import { ref } from "vue"
const iconValue = ref("")
const changeSelect = (val: string) => {
console.log(`选择的值:${val};v-model值:${iconValue.value}`)
}
</script>
14 changes: 14 additions & 0 deletions docs/examples/TSelectIcon/isShowIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<t-layout-page>
<t-layout-page-item>
<t-select-icon v-model="iconValue" @select="changeSelect" :isShowIcon="false" />
</t-layout-page-item>
</t-layout-page>
</template>
<script setup lang="ts">
import { ref } from "vue"
const iconValue = ref("")
const changeSelect = (val: string) => {
console.log(`选择的值:${val};v-model值:${iconValue.value}`)
}
</script>
14 changes: 14 additions & 0 deletions docs/examples/TSelectIcon/isShowSearch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<t-layout-page>
<t-layout-page-item>
<t-select-icon v-model="iconValue" @select="changeSelect" :isShowSearch="false" />
</t-layout-page-item>
</t-layout-page>
</template>
<script setup lang="ts">
import { ref } from "vue"
const iconValue = ref("")
const changeSelect = (val: string) => {
console.log(`选择的值:${val};v-model值:${iconValue.value}`)
}
</script>
Loading

0 comments on commit 1c54dfe

Please sign in to comment.