hw-cus-ui 1.0.25 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HwCheckbox/README.md +111 -0
- package/HwDraggableBottomPopup/README.md +127 -0
- package/HwFileUpload/README.md +119 -0
- package/HwInput/README.md +134 -0
- package/HwPickerTree/HwPickerTree.vue +212 -84
- package/HwPickerTree/README.md +190 -0
- package/HwSelect/README.md +122 -0
- package/HwTabs/HwTabs.vue +332 -0
- package/HwTabs/index.ts +10 -0
- package/HwTabs/props.js +100 -0
- package/HwTabs/readme.md +276 -0
- package/HwTabs/utils.js +110 -0
- package/index.d.ts +3 -1
- package/index.ts +14 -2
- package/package.json +2 -2
- package/z-paging/changelog.md +51 -0
- package/z-paging/components/z-paging/components/z-paging-load-more.vue +182 -0
- package/z-paging/components/z-paging/components/z-paging-refresh.vue +214 -0
- package/z-paging/components/z-paging/config/index.js +3 -0
- package/z-paging/components/z-paging/css/z-paging-main.css +241 -0
- package/z-paging/components/z-paging/css/z-paging-static.css +50 -0
- package/z-paging/components/z-paging/i18n/en.json +23 -0
- package/z-paging/components/z-paging/i18n/index.js +8 -0
- package/z-paging/components/z-paging/i18n/zh-Hans.json +23 -0
- package/z-paging/components/z-paging/i18n/zh-Hant.json +23 -0
- package/z-paging/components/z-paging/js/hooks/useZPaging.js +25 -0
- package/z-paging/components/z-paging/js/hooks/useZPagingComp.js +25 -0
- package/z-paging/components/z-paging/js/modules/back-to-top.js +125 -0
- package/z-paging/components/z-paging/js/modules/chat-record-mode.js +153 -0
- package/z-paging/components/z-paging/js/modules/common-layout.js +152 -0
- package/z-paging/components/z-paging/js/modules/data-handle.js +744 -0
- package/z-paging/components/z-paging/js/modules/empty.js +144 -0
- package/z-paging/components/z-paging/js/modules/i18n.js +113 -0
- package/z-paging/components/z-paging/js/modules/load-more.js +374 -0
- package/z-paging/components/z-paging/js/modules/loading.js +95 -0
- package/z-paging/components/z-paging/js/modules/nvue.js +299 -0
- package/z-paging/components/z-paging/js/modules/refresher.js +890 -0
- package/z-paging/components/z-paging/js/modules/scroller.js +605 -0
- package/z-paging/components/z-paging/js/modules/virtual-list.js +539 -0
- package/z-paging/components/z-paging/js/z-paging-constant.js +19 -0
- package/z-paging/components/z-paging/js/z-paging-enum.js +45 -0
- package/z-paging/components/z-paging/js/z-paging-interceptor.js +97 -0
- package/z-paging/components/z-paging/js/z-paging-main.js +537 -0
- package/z-paging/components/z-paging/js/z-paging-mixin.js +22 -0
- package/z-paging/components/z-paging/js/z-paging-static.js +13 -0
- package/z-paging/components/z-paging/js/z-paging-utils.js +322 -0
- package/z-paging/components/z-paging/wxs/z-paging-renderjs.js +67 -0
- package/z-paging/components/z-paging/wxs/z-paging-wxs.wxs +382 -0
- package/z-paging/components/z-paging/z-paging.vue +655 -0
- package/z-paging/components/z-paging-cell/z-paging-cell.vue +47 -0
- package/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue +209 -0
- package/z-paging/components/z-paging-swiper/z-paging-swiper.vue +176 -0
- package/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue +160 -0
- package/z-paging/package.json +89 -0
- package/z-paging/readme.md +57 -0
- package/z-paging/types/comps/_common.d.ts +9 -0
- package/z-paging/types/comps/z-paging-cell.d.ts +29 -0
- package/z-paging/types/comps/z-paging-empty-view.d.ts +95 -0
- package/z-paging/types/comps/z-paging-swiper-item.d.ts +95 -0
- package/z-paging/types/comps/z-paging-swiper.d.ts +89 -0
- package/z-paging/types/comps/z-paging.d.ts +2131 -0
- package/z-paging/types/comps.d.ts +11 -0
- package/z-paging/types/index.d.ts +24 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# HwCheckbox 组件使用说明
|
|
2
|
+
|
|
3
|
+
HwCheckbox 是一个复选框组件,支持编辑模式和详情模式,可以显示复选框或只读文本。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 支持编辑模式和详情模式
|
|
8
|
+
- 支持双向数据绑定
|
|
9
|
+
- 支持自定义选项数据
|
|
10
|
+
- 支持必填标识显示
|
|
11
|
+
- 支持自定义样式
|
|
12
|
+
|
|
13
|
+
## 属性 (Props)
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
16
|
+
|------|------|--------|------|
|
|
17
|
+
| [marginTop](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L41-L43) | string | '20px' | 上边距 |
|
|
18
|
+
| [pageType](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L44-L46) | string | 'checkbox' | 页面类型,用于区分编辑页面还是详情页面 |
|
|
19
|
+
| [label](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L47-L49) | string | - | 字段标签名称(必填) |
|
|
20
|
+
| [types](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L50-L52) | string | 'add' | 类型标识,用于控制样式显示 |
|
|
21
|
+
| [required](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L53-L55) | boolean | false | 是否必填项,true时会显示红色星号 |
|
|
22
|
+
| [localdata](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L56-L59) | Array<any> | - | 下拉选项数据列表,每项应包含value和text属性 |
|
|
23
|
+
|
|
24
|
+
## 事件 (Events)
|
|
25
|
+
|
|
26
|
+
| 事件名 | 参数 | 说明 |
|
|
27
|
+
|-------|------|------|
|
|
28
|
+
| update:modelValue | (value: string \| number) | 当值变化时触发 |
|
|
29
|
+
|
|
30
|
+
## 使用示例
|
|
31
|
+
|
|
32
|
+
### 基础用法
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<template>
|
|
36
|
+
<HwCheckbox
|
|
37
|
+
v-model="checkboxValue"
|
|
38
|
+
label="选择项"
|
|
39
|
+
:localdata="checkboxOptions"
|
|
40
|
+
/>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup>
|
|
44
|
+
import { ref } from 'vue';
|
|
45
|
+
import HwCheckbox from '@/components/HwCheckbox/HwCheckbox.vue';
|
|
46
|
+
|
|
47
|
+
const checkboxValue = ref('');
|
|
48
|
+
const checkboxOptions = [
|
|
49
|
+
{ value: 'option1', text: '选项1' },
|
|
50
|
+
{ value: 'option2', text: '选项2' },
|
|
51
|
+
{ value: 'option3', text: '选项3' }
|
|
52
|
+
];
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 详情模式
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<template>
|
|
60
|
+
<HwCheckbox
|
|
61
|
+
v-model="checkboxValue"
|
|
62
|
+
label="选择项"
|
|
63
|
+
:localdata="checkboxOptions"
|
|
64
|
+
pageType="detail"
|
|
65
|
+
/>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup>
|
|
69
|
+
import { ref } from 'vue';
|
|
70
|
+
import HwCheckbox from '@/components/HwCheckbox/HwCheckbox.vue';
|
|
71
|
+
|
|
72
|
+
const checkboxValue = ref('option1');
|
|
73
|
+
const checkboxOptions = [
|
|
74
|
+
{ value: 'option1', text: '选项1' },
|
|
75
|
+
{ value: 'option2', text: '选项2' },
|
|
76
|
+
{ value: 'option3', text: '选项3' }
|
|
77
|
+
];
|
|
78
|
+
</script>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 必填项
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<template>
|
|
85
|
+
<HwCheckbox
|
|
86
|
+
v-model="checkboxValue"
|
|
87
|
+
label="必填选择项"
|
|
88
|
+
:required="true"
|
|
89
|
+
:localdata="checkboxOptions"
|
|
90
|
+
/>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup>
|
|
94
|
+
import { ref } from 'vue';
|
|
95
|
+
import HwCheckbox from '@/components/HwCheckbox/HwCheckbox.vue';
|
|
96
|
+
|
|
97
|
+
const checkboxValue = ref('');
|
|
98
|
+
const checkboxOptions = [
|
|
99
|
+
{ value: 'option1', text: '选项1' },
|
|
100
|
+
{ value: 'option2', text: '选项2' }
|
|
101
|
+
];
|
|
102
|
+
</script>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 注意事项
|
|
106
|
+
|
|
107
|
+
1. 组件使用了 uni-data-checkbox 作为基础组件
|
|
108
|
+
2. 在详情模式下,组件只显示选中项的文本,不提供编辑功能
|
|
109
|
+
3. [localdata](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L56-L59) 属性的每个选项对象需要包含 [value](file:///e:/temp/my-components/src/components/HwPickerTree/HwPickerTree.vue#L35-L40) 和 text 属性
|
|
110
|
+
4. [pageType](file:///e:/temp/my-components/src/components/HwCheckbox/HwCheckbox.vue#L44-L46) 设置为 'detail' 时会显示为只读的详情模式
|
|
111
|
+
5. 组件支持通过插槽自定义内容
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# HwDraggableBottomPopup 组件使用说明
|
|
2
|
+
|
|
3
|
+
HwDraggableBottomPopup 是一个可拖拽的底部弹窗组件,支持触摸拖拽调整位置,适用于需要用户交互调整内容区域的场景。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 支持触摸拖拽调整弹窗位置
|
|
8
|
+
- 可自定义弹窗高度
|
|
9
|
+
- 支持拖拽过程中实时调整内容区域高度
|
|
10
|
+
- 防抖处理确保性能
|
|
11
|
+
- 灵活的内容插槽
|
|
12
|
+
|
|
13
|
+
## 属性 (Props)
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
16
|
+
|------|------|--------|------|
|
|
17
|
+
| [heightCalc](file:///e:/temp/my-components/src/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue#L31-L35) | String | '0.4' | 弹窗高度计算比例,相对于屏幕高度的百分比 |
|
|
18
|
+
| [isDrag](file:///e:/temp/my-components/src/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue#L36-L40) | Boolean | true | 是否启用拖拽功能 |
|
|
19
|
+
|
|
20
|
+
## 事件 (Events)
|
|
21
|
+
|
|
22
|
+
| 事件名 | 参数 | 说明 |
|
|
23
|
+
|-------|------|------|
|
|
24
|
+
| changeTop | (top: number) | 拖拽过程中顶部位置变化时触发 |
|
|
25
|
+
|
|
26
|
+
## 插槽 (Slots)
|
|
27
|
+
|
|
28
|
+
| 插槽名 | 说明 |
|
|
29
|
+
|--------|------|
|
|
30
|
+
| default | 默认插槽,用于放置弹窗内容 |
|
|
31
|
+
|
|
32
|
+
## 使用示例
|
|
33
|
+
|
|
34
|
+
### 基础用法
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
<template>
|
|
38
|
+
<view>
|
|
39
|
+
<HwDraggableBottomPopup>
|
|
40
|
+
<view class="popup-content">
|
|
41
|
+
<p>这里是弹窗内容</p>
|
|
42
|
+
<p>可以放置任何内容</p>
|
|
43
|
+
</view>
|
|
44
|
+
</HwDraggableBottomPopup>
|
|
45
|
+
</view>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup>
|
|
49
|
+
import HwDraggableBottomPopup from '@/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue';
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.popup-content {
|
|
54
|
+
padding: 20rpx;
|
|
55
|
+
height: 100%;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 自定义高度
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<template>
|
|
64
|
+
<view>
|
|
65
|
+
<HwDraggableBottomPopup :heightCalc="'0.6'">
|
|
66
|
+
<view class="popup-content">
|
|
67
|
+
<p>初始高度为屏幕高度的60%</p>
|
|
68
|
+
</view>
|
|
69
|
+
</HwDraggableBottomPopup>
|
|
70
|
+
</view>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script setup>
|
|
74
|
+
import HwDraggableBottomPopup from '@/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue';
|
|
75
|
+
</script>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 禁用拖拽
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<template>
|
|
82
|
+
<view>
|
|
83
|
+
<HwDraggableBottomPopup :isDrag="false">
|
|
84
|
+
<view class="popup-content">
|
|
85
|
+
<p>此弹窗不可拖拽</p>
|
|
86
|
+
</view>
|
|
87
|
+
</HwDraggableBottomPopup>
|
|
88
|
+
</view>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script setup>
|
|
92
|
+
import HwDraggableBottomPopup from '@/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue';
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 监听位置变化
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<template>
|
|
100
|
+
<view>
|
|
101
|
+
<HwDraggableBottomPopup @changeTop="onTopChange">
|
|
102
|
+
<view class="popup-content">
|
|
103
|
+
<p>拖拽弹窗查看位置变化</p>
|
|
104
|
+
</view>
|
|
105
|
+
</HwDraggableBottomPopup>
|
|
106
|
+
</view>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script setup>
|
|
110
|
+
import { ref } from 'vue';
|
|
111
|
+
import HwDraggableBottomPopup from '@/components/HwDraggableBottomPopup/HwDraggableBottomPopup.vue';
|
|
112
|
+
|
|
113
|
+
const onTopChange = (top) => {
|
|
114
|
+
console.log('弹窗顶部位置:', top);
|
|
115
|
+
};
|
|
116
|
+
</script>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 注意事项
|
|
120
|
+
|
|
121
|
+
1. 组件使用了 uni-app 的触摸事件和系统信息API
|
|
122
|
+
2. 弹窗默认从屏幕底部开始,初始位置在屏幕外
|
|
123
|
+
3. 拖拽功能通过触摸事件实现,支持触摸开始、移动和结束
|
|
124
|
+
4. 弹窗内容区域高度会根据拖拽位置自动调整
|
|
125
|
+
5. 组件使用了防抖函数优化性能,避免频繁更新内容区域高度
|
|
126
|
+
6. 当启用拖拽功能时,组件会添加圆角边框以提供更好的视觉效果
|
|
127
|
+
7. 组件内部使用了 flex 布局,内容区域会自动适应可用空间
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# HwFileUpload 组件使用说明
|
|
2
|
+
|
|
3
|
+
HwFileUpload 是一个文件上传组件,支持图片和文件上传、预览、下载和删除功能。可通过 [isImg](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L63-L63) 属性控制是图片模式还是文件模式展示。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 支持图片和文件上传
|
|
8
|
+
- 支持图片预览功能
|
|
9
|
+
- 支持文件下载功能
|
|
10
|
+
- 支持文件删除功能
|
|
11
|
+
- 可切换图片模式和文件模式
|
|
12
|
+
- 支持多种文件类型的上传限制
|
|
13
|
+
- 支持详情模式和添加模式
|
|
14
|
+
|
|
15
|
+
## 属性 (Props)
|
|
16
|
+
|
|
17
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
18
|
+
|------|------|--------|------|
|
|
19
|
+
| [fileType](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L54-L54) | Array | ['pdf', 'xlsx', 'docx', 'doc', 'zip', 'rar', 'exe'] | 允许上传的文件类型列表 |
|
|
20
|
+
| [modelValue](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L55-L55) | Array | - | 绑定值,文件列表 |
|
|
21
|
+
| [isImg](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L63-L63) | boolean | false | 是否为图片模式 |
|
|
22
|
+
| [border](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L64-L64) | boolean | true | 是否显示下边框 |
|
|
23
|
+
| [marginTop](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L65-L65) | string | '20px' | 上边距 |
|
|
24
|
+
| [types](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L66-L66) | string | 'add' | 组件类型,'add' 为添加模式,'detail' 为详情模式 |
|
|
25
|
+
| [required](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L67-L67) | boolean | false | 是否必填 |
|
|
26
|
+
| [label](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L68-L68) | string | - | 标签文本 |
|
|
27
|
+
| [isLink](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L59-L59) | boolean | false | 是否为链接模式 |
|
|
28
|
+
| [baseUrl](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L60-L60) | string | '' | 基础URL |
|
|
29
|
+
| [apiUrl](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L61-L61) | string | '' | API上传地址 |
|
|
30
|
+
| [headers](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L62-L62) | object | {} | 上传请求头 |
|
|
31
|
+
|
|
32
|
+
## 事件 (Events)
|
|
33
|
+
|
|
34
|
+
| 事件名 | 参数 | 说明 |
|
|
35
|
+
|-------|------|------|
|
|
36
|
+
| update:modelValue | (value: any[]) | 当文件列表发生变化时触发 |
|
|
37
|
+
|
|
38
|
+
## 使用示例
|
|
39
|
+
|
|
40
|
+
### 图片上传模式
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<template>
|
|
44
|
+
<HwFileUpload
|
|
45
|
+
v-model="imageList"
|
|
46
|
+
label="图片上传"
|
|
47
|
+
:isImg="true"
|
|
48
|
+
:fileType="['jpg', 'jpeg', 'png', 'gif']"
|
|
49
|
+
:required="true"
|
|
50
|
+
apiUrl="/api/upload"
|
|
51
|
+
:headers="headers"
|
|
52
|
+
/>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
import { ref } from 'vue';
|
|
57
|
+
import HwFileUpload from '@/components/HwFileUpload/HwFileUpload.vue';
|
|
58
|
+
|
|
59
|
+
const imageList = ref([]);
|
|
60
|
+
const headers = { 'Authorization': 'Bearer token' };
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 文件上传模式
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<template>
|
|
68
|
+
<HwFileUpload
|
|
69
|
+
v-model="fileList"
|
|
70
|
+
label="附件上传"
|
|
71
|
+
:isImg="false"
|
|
72
|
+
:fileType="['pdf', 'doc', 'docx', 'xlsx']"
|
|
73
|
+
:required="true"
|
|
74
|
+
apiUrl="/api/upload"
|
|
75
|
+
:headers="headers"
|
|
76
|
+
/>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script setup>
|
|
80
|
+
import { ref } from 'vue';
|
|
81
|
+
import HwFileUpload from '@/components/HwFileUpload/HwFileUpload.vue';
|
|
82
|
+
|
|
83
|
+
const fileList = ref([]);
|
|
84
|
+
const headers = { 'Authorization': 'Bearer token' };
|
|
85
|
+
</script>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 详情模式(只读)
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<template>
|
|
92
|
+
<HwFileUpload
|
|
93
|
+
v-model="fileList"
|
|
94
|
+
label="附件列表"
|
|
95
|
+
:isImg="false"
|
|
96
|
+
types="detail"
|
|
97
|
+
:required="false"
|
|
98
|
+
/>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup>
|
|
102
|
+
import { ref } from 'vue';
|
|
103
|
+
import HwFileUpload from '@/components/HwFileUpload/HwFileUpload.vue';
|
|
104
|
+
|
|
105
|
+
const fileList = ref([
|
|
106
|
+
{ name: 'example.pdf', url: '/path/to/example.pdf' },
|
|
107
|
+
{ name: 'document.docx', url: '/path/to/document.docx' }
|
|
108
|
+
]);
|
|
109
|
+
</script>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 注意事项
|
|
113
|
+
|
|
114
|
+
1. 上传功能需要配置 [apiUrl](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L61-L61) 和 [baseUrl](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L60-L60) 属性
|
|
115
|
+
2. 文件类型限制通过 [fileType](file:///e:/temp/my-components/src/components/HwFileUpload/HwFileUpload.vue#L54-L54) 属性控制
|
|
116
|
+
3. 在详情模式下,组件只显示文件列表,不提供上传、删除等操作
|
|
117
|
+
4. 文件大小显示单位为KB
|
|
118
|
+
5. 图片上传使用 [uni.previewImage](file:///e:/temp/my-components/node_modules/@dcloudio/uni-app-plus/types/index.d.ts#L210-L216) 进行预览
|
|
119
|
+
6. 文件下载使用 [file-saver](file:///e:/temp/my-components/package.json#L24-L24) 库实现
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# HwInput 组件使用说明
|
|
2
|
+
|
|
3
|
+
HwInput 是一个输入框组件,支持编辑模式和详情模式,可以显示输入框或只读文本。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 支持编辑模式和详情模式
|
|
8
|
+
- 支持双向数据绑定
|
|
9
|
+
- 支持自定义样式
|
|
10
|
+
- 支持必填标识显示
|
|
11
|
+
- 支持子值显示
|
|
12
|
+
|
|
13
|
+
## 属性 (Props)
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
16
|
+
|------|------|--------|------|
|
|
17
|
+
| [marginTop](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L42-L42) | string | '20px' | 上边距 |
|
|
18
|
+
| [types](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L43-L43) | string | 'add' | 组件类型,'add'为编辑模式,'detail'为详情模式 |
|
|
19
|
+
| [subValue](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L44-L44) | string | '' | 子值,在详情模式下额外显示的信息 |
|
|
20
|
+
| [styles](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L45-L45) | object | {} | 自定义样式对象 |
|
|
21
|
+
| [required](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L46-L46) | boolean | false | 是否必填,为true时显示红色星号 |
|
|
22
|
+
| [borderBottom](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L47-L47) | string | '1rpx solid rgba(17, 31, 44, 0.12)' | 设置下边框 |
|
|
23
|
+
| [label](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L48-L48) | string | - | 标签文本,必填项 |
|
|
24
|
+
|
|
25
|
+
## 事件 (Events)
|
|
26
|
+
|
|
27
|
+
| 事件名 | 参数 | 说明 |
|
|
28
|
+
|-------|------|------|
|
|
29
|
+
| update:modelValue | (value: string \| number) | 当值变化时触发 |
|
|
30
|
+
|
|
31
|
+
## 使用示例
|
|
32
|
+
|
|
33
|
+
### 基础用法
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<template>
|
|
37
|
+
<HwInput
|
|
38
|
+
v-model="inputValue"
|
|
39
|
+
label="姓名"
|
|
40
|
+
/>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup>
|
|
44
|
+
import { ref } from 'vue';
|
|
45
|
+
import HwInput from '@/components/HwInput/HwInput.vue';
|
|
46
|
+
|
|
47
|
+
const inputValue = ref('');
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 详情模式
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<template>
|
|
55
|
+
<HwInput
|
|
56
|
+
v-model="inputValue"
|
|
57
|
+
label="姓名"
|
|
58
|
+
types="detail"
|
|
59
|
+
/>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup>
|
|
63
|
+
import { ref } from 'vue';
|
|
64
|
+
import HwInput from '@/components/HwInput/HwInput.vue';
|
|
65
|
+
|
|
66
|
+
const inputValue = ref('张三');
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 必填项
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<HwInput
|
|
75
|
+
v-model="inputValue"
|
|
76
|
+
label="邮箱"
|
|
77
|
+
:required="true"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup>
|
|
82
|
+
import { ref } from 'vue';
|
|
83
|
+
import HwInput from '@/components/HwInput/HwInput.vue';
|
|
84
|
+
|
|
85
|
+
const inputValue = ref('');
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 带子值的详情模式
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<template>
|
|
93
|
+
<HwInput
|
|
94
|
+
v-model="inputValue"
|
|
95
|
+
label="价格"
|
|
96
|
+
types="detail"
|
|
97
|
+
subValue="元"
|
|
98
|
+
/>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup>
|
|
102
|
+
import { ref } from 'vue';
|
|
103
|
+
import HwInput from '@/components/HwInput/HwInput.vue';
|
|
104
|
+
|
|
105
|
+
const inputValue = ref('100');
|
|
106
|
+
</script>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 自定义样式
|
|
110
|
+
|
|
111
|
+
```vue
|
|
112
|
+
<template>
|
|
113
|
+
<HwInput
|
|
114
|
+
v-model="inputValue"
|
|
115
|
+
label="描述"
|
|
116
|
+
:styles="{ color: 'blue', fontSize: '36rpx' }"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script setup>
|
|
121
|
+
import { ref } from 'vue';
|
|
122
|
+
import HwInput from '@/components/HwInput/HwInput.vue';
|
|
123
|
+
|
|
124
|
+
const inputValue = ref('');
|
|
125
|
+
</script>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 注意事项
|
|
129
|
+
|
|
130
|
+
1. 组件使用了 uni-easyinput 作为基础组件
|
|
131
|
+
2. 在详情模式下,组件只显示值,不提供编辑功能
|
|
132
|
+
3. [types](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L43-L43) 设置为 'detail' 时会显示为只读的详情模式
|
|
133
|
+
4. 如果 [value](file:///e:/temp/my-components/src/components/HwPickerTree/HwPickerTree.vue#L35-L40) 为空,在详情模式下会显示为 '-'
|
|
134
|
+
5. [subValue](file:///e:/temp/my-components/src/components/HwInput/HwInput.vue#L44-L44) 只在详情模式下且有值时显示
|