uview-pro 0.2.0 → 0.2.2
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/changelog.md +501 -459
- package/components/common/props.ts +22 -22
- package/components/u-action-sheet/types.ts +35 -35
- package/components/u-action-sheet/u-action-sheet.vue +160 -160
- package/components/u-alert-tips/types.ts +39 -39
- package/components/u-alert-tips/u-alert-tips.vue +212 -212
- package/components/u-avatar/types.ts +34 -34
- package/components/u-avatar/u-avatar.vue +193 -193
- package/components/u-avatar-cropper/types.ts +23 -23
- package/components/u-avatar-cropper/u-avatar-cropper.vue +286 -286
- package/components/u-avatar-cropper/weCropper.d.ts +62 -62
- package/components/u-avatar-cropper/weCropper.js +1253 -1253
- package/components/u-avatar-cropper/weCropper.ts +1255 -1255
- package/components/u-back-top/types.ts +39 -39
- package/components/u-back-top/u-back-top.vue +125 -125
- package/components/u-badge/types.ts +36 -36
- package/components/u-badge/u-badge.vue +165 -165
- package/components/u-button/types.ts +66 -66
- package/components/u-button/u-button.vue +556 -556
- package/components/u-calendar/types.ts +73 -63
- package/components/u-calendar/u-calendar.vue +638 -592
- package/components/u-car-keyboard/types.ts +12 -12
- package/components/u-car-keyboard/u-car-keyboard.vue +234 -234
- package/components/u-card/types.ts +59 -59
- package/components/u-card/u-card.vue +194 -194
- package/components/u-cell-group/types.ts +17 -17
- package/components/u-cell-group/u-cell-group.vue +50 -50
- package/components/u-cell-item/types.ts +54 -54
- package/components/u-cell-item/u-cell-item.vue +202 -202
- package/components/u-checkbox/types.ts +31 -31
- package/components/u-checkbox/u-checkbox.vue +267 -267
- package/components/u-checkbox-group/types.ts +32 -32
- package/components/u-checkbox-group/u-checkbox-group.vue +79 -79
- package/components/u-circle-progress/types.ts +52 -52
- package/components/u-circle-progress/u-circle-progress.vue +187 -187
- package/components/u-city-select/types.ts +20 -20
- package/components/u-city-select/u-city-select.vue +236 -236
- package/components/u-col/types.ts +30 -30
- package/components/u-col/u-col.vue +123 -123
- package/components/u-collapse/types.ts +33 -33
- package/components/u-collapse/u-collapse.vue +69 -69
- package/components/u-collapse-item/types.ts +27 -27
- package/components/u-collapse-item/u-collapse-item.vue +213 -201
- package/components/u-column-notice/types.ts +48 -48
- package/components/u-column-notice/u-column-notice.vue +176 -176
- package/components/u-count-down/types.ts +42 -42
- package/components/u-count-down/u-count-down.vue +258 -258
- package/components/u-count-to/types.ts +32 -32
- package/components/u-count-to/u-count-to.vue +241 -241
- package/components/u-divider/types.ts +31 -31
- package/components/u-divider/u-divider.vue +121 -121
- package/components/u-dropdown/types.ts +32 -32
- package/components/u-dropdown/u-dropdown.vue +289 -289
- package/components/u-dropdown-item/types.ts +27 -27
- package/components/u-dropdown-item/u-dropdown-item.vue +123 -123
- package/components/u-empty/types.ts +36 -36
- package/components/u-empty/u-empty.vue +88 -88
- package/components/u-field/types.ts +69 -69
- package/components/u-field/u-field.vue +354 -354
- package/components/u-form/u-form.vue +132 -132
- package/components/u-form-item/u-form-item.vue +417 -417
- package/components/u-full-screen/types.ts +14 -14
- package/components/u-full-screen/u-full-screen.vue +82 -82
- package/components/u-gap/types.ts +18 -18
- package/components/u-gap/u-gap.vue +40 -40
- package/components/u-grid/types.ts +19 -19
- package/components/u-grid/u-grid.vue +93 -93
- package/components/u-grid-item/types.ts +16 -16
- package/components/u-grid-item/u-grid-item.vue +130 -130
- package/components/u-icon/types.ts +62 -62
- package/components/u-icon/u-icon.vue +281 -281
- package/components/u-image/types.ts +51 -51
- package/components/u-image/u-image.vue +222 -222
- package/components/u-index-anchor/types.ts +16 -16
- package/components/u-index-anchor/u-index-anchor.vue +86 -86
- package/components/u-index-list/types.ts +43 -43
- package/components/u-index-list/u-index-list.vue +355 -355
- package/components/u-input/types.ts +140 -140
- package/components/u-input/u-input.vue +264 -264
- package/components/u-keyboard/types.ts +40 -40
- package/components/u-keyboard/u-keyboard.vue +158 -158
- package/components/u-lazy-load/types.ts +37 -37
- package/components/u-lazy-load/u-lazy-load.vue +233 -233
- package/components/u-line/types.ts +44 -44
- package/components/u-line/u-line.vue +59 -59
- package/components/u-line-progress/types.ts +58 -58
- package/components/u-line-progress/u-line-progress.vue +109 -109
- package/components/u-link/types.ts +43 -43
- package/components/u-link/u-link.vue +75 -75
- package/components/u-loading/types.ts +35 -35
- package/components/u-loading/u-loading.vue +90 -90
- package/components/u-loading-popup/types.ts +26 -26
- package/components/u-loading-popup/u-loading-popup.vue +239 -239
- package/components/u-loadmore/types.ts +79 -79
- package/components/u-loadmore/u-loadmore.vue +140 -140
- package/components/u-mask/types.ts +43 -43
- package/components/u-mask/u-mask.vue +106 -106
- package/components/u-message-input/types.ts +74 -74
- package/components/u-message-input/u-message-input.vue +255 -255
- package/components/u-modal/types.ts +118 -118
- package/components/u-modal/u-modal.vue +204 -204
- package/components/u-navbar/types.ts +103 -103
- package/components/u-navbar/u-navbar.vue +226 -226
- package/components/u-no-network/image.ts +2 -2
- package/components/u-no-network/types.ts +28 -28
- package/components/u-no-network/u-no-network.vue +290 -290
- package/components/u-notice-bar/types.ts +111 -111
- package/components/u-notice-bar/u-notice-bar.vue +174 -174
- package/components/u-number-box/types.ts +42 -42
- package/components/u-number-box/u-number-box.vue +312 -312
- package/components/u-number-keyboard/types.ts +26 -26
- package/components/u-number-keyboard/u-number-keyboard.vue +166 -166
- package/components/u-picker/types.ts +123 -123
- package/components/u-picker/u-picker.vue +637 -637
- package/components/u-popup/types.ts +59 -59
- package/components/u-popup/u-popup.vue +359 -359
- package/components/u-radio/types.ts +25 -25
- package/components/u-radio/u-radio.vue +258 -258
- package/components/u-radio-group/types.ts +29 -29
- package/components/u-radio-group/u-radio-group.vue +98 -98
- package/components/u-rate/types.ts +40 -40
- package/components/u-rate/u-rate.vue +234 -234
- package/components/u-read-more/types.ts +35 -35
- package/components/u-read-more/u-read-more.vue +150 -150
- package/components/u-root-portal/u-root-portal.vue +54 -0
- package/components/u-row/types.ts +20 -20
- package/components/u-row/u-row.vue +87 -87
- package/components/u-row-notice/types.ts +39 -39
- package/components/u-row-notice/u-row-notice.vue +213 -213
- package/components/u-safe-bottom/u-safe-bottom.vue +46 -46
- package/components/u-search/types.ts +53 -53
- package/components/u-search/u-search.vue +256 -256
- package/components/u-section/types.ts +32 -32
- package/components/u-section/u-section.vue +125 -125
- package/components/u-select/types.ts +43 -43
- package/components/u-select/u-select.vue +361 -361
- package/components/u-skeleton/types.ts +20 -20
- package/components/u-skeleton/u-skeleton.vue +205 -205
- package/components/u-slider/types.ts +32 -32
- package/components/u-slider/u-slider.vue +238 -238
- package/components/u-status-bar/u-status-bar.vue +65 -65
- package/components/u-steps/types.ts +28 -28
- package/components/u-steps/u-steps.vue +160 -160
- package/components/u-sticky/types.ts +22 -22
- package/components/u-sticky/u-sticky.vue +159 -159
- package/components/u-subsection/types.ts +36 -36
- package/components/u-subsection/u-subsection.vue +328 -328
- package/components/u-swipe-action/types.ts +50 -50
- package/components/u-swipe-action/u-swipe-action.vue +253 -253
- package/components/u-swiper/types.ts +47 -47
- package/components/u-swiper/u-swiper.vue +266 -266
- package/components/u-switch/types.ts +28 -28
- package/components/u-switch/u-switch.vue +136 -136
- package/components/u-tabbar/types.ts +36 -36
- package/components/u-tabbar/u-tabbar.vue +280 -280
- package/components/u-table/types.ts +25 -25
- package/components/u-table/u-table.vue +55 -55
- package/components/u-tabs/types.ts +51 -51
- package/components/u-tabs/u-tabs.vue +284 -284
- package/components/u-tabs-swiper/types.ts +53 -53
- package/components/u-tabs-swiper/u-tabs-swiper.vue +379 -379
- package/components/u-tag/types.ts +37 -37
- package/components/u-tag/u-tag.vue +244 -244
- package/components/u-td/types.ts +12 -12
- package/components/u-td/u-td.vue +87 -87
- package/components/u-text/types.ts +69 -69
- package/components/u-text/u-text.vue +326 -326
- package/components/u-th/types.ts +12 -12
- package/components/u-th/u-th.vue +81 -81
- package/components/u-time-line/u-time-line.vue +39 -39
- package/components/u-time-line-item/types.ts +14 -14
- package/components/u-time-line-item/u-time-line-item.vue +78 -78
- package/components/u-toast/types.ts +36 -36
- package/components/u-toast/u-toast.vue +233 -233
- package/components/u-top-tips/types.ts +14 -14
- package/components/u-top-tips/u-top-tips.vue +113 -113
- package/components/u-tr/types.ts +8 -8
- package/components/u-tr/u-tr.vue +24 -24
- package/components/u-upload/types.ts +74 -74
- package/components/u-upload/u-upload.vue +545 -545
- package/components/u-verification-code/types.ts +22 -22
- package/components/u-verification-code/u-verification-code.vue +164 -164
- package/components/u-waterfall/types.ts +16 -16
- package/components/u-waterfall/u-waterfall.vue +175 -175
- package/iconfont.css +912 -912
- package/index.scss +25 -25
- package/index.ts +29 -29
- package/libs/config/config.ts +26 -26
- package/libs/config/zIndex.ts +37 -37
- package/libs/css/color.scss +155 -155
- package/libs/css/common.scss +178 -178
- package/libs/css/style.components.scss +16 -16
- package/libs/css/style.h5.scss +8 -8
- package/libs/css/style.mp.scss +72 -72
- package/libs/css/style.nvue.scss +15 -15
- package/libs/css/style.vue.scss +188 -188
- package/libs/function/$parent.ts +21 -21
- package/libs/function/addUnit.ts +13 -13
- package/libs/function/color.ts +37 -37
- package/libs/function/colorGradient.ts +125 -125
- package/libs/function/debounce.ts +28 -28
- package/libs/function/deepClone.ts +39 -39
- package/libs/function/deepMerge.ts +34 -34
- package/libs/function/getParent.ts +59 -59
- package/libs/function/getRect.ts +26 -26
- package/libs/function/guid.ts +42 -42
- package/libs/function/md5.ts +391 -391
- package/libs/function/parent.ts +21 -21
- package/libs/function/queryParams.ts +60 -60
- package/libs/function/random.ts +16 -16
- package/libs/function/randomArray.ts +11 -11
- package/libs/function/route.ts +118 -118
- package/libs/function/styleUtils.ts +83 -83
- package/libs/function/sys.ts +15 -15
- package/libs/function/test.ts +285 -285
- package/libs/function/throttle.ts +31 -31
- package/libs/function/timeFormat.ts +54 -54
- package/libs/function/timeFrom.ts +48 -48
- package/libs/function/toast.ts +14 -14
- package/libs/function/trim.ts +21 -21
- package/libs/function/type2icon.ts +36 -36
- package/libs/hooks/index.ts +3 -3
- package/libs/hooks/useEmitter.ts +77 -77
- package/libs/hooks/useParent.ts +31 -31
- package/libs/hooks/useRect.ts +33 -33
- package/libs/index.ts +291 -291
- package/libs/request/auto-http.ts +76 -76
- package/libs/request/index.ts +223 -223
- package/libs/store/index.ts +88 -88
- package/libs/util/area.ts +1 -3771
- package/libs/util/async-validator.d.ts +62 -62
- package/libs/util/async-validator.js +1 -1368
- package/libs/util/calendar.d.ts +57 -0
- package/libs/util/calendar.js +1 -0
- package/libs/util/city.ts +1 -432
- package/libs/util/emitter.ts +102 -102
- package/libs/util/mitt.ts +115 -115
- package/libs/util/parent.ts +20 -20
- package/libs/util/province.ts +1 -37
- package/package.json +1 -1
- package/readme.md +239 -237
- package/theme.scss +38 -38
- package/types/components.d.ts +97 -96
- package/types/global.d.ts +295 -255
- package/types/ignore-errors.d.ts +30 -30
- package/types/index.d.ts +19 -19
- package/types/uni-app.d.ts +63 -63
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent @tap.stop.prevent>
|
|
3
|
-
<block v-if="!slots.default && !slots.$default">
|
|
4
|
-
<scroll-view scroll-y="true" :style="{ height: $u.addUnit(height) }">
|
|
5
|
-
<view class="u-dropdown-item__options">
|
|
6
|
-
<u-cell-group>
|
|
7
|
-
<u-cell-item
|
|
8
|
-
@click="cellClick(item.value)"
|
|
9
|
-
:arrow="false"
|
|
10
|
-
:title="item.label"
|
|
11
|
-
v-for="(item, index) in options"
|
|
12
|
-
:key="index"
|
|
13
|
-
:title-style="{ color: modelValue == item.value ? activeColor : inactiveColor }"
|
|
14
|
-
>
|
|
15
|
-
<u-icon v-if="modelValue == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
|
|
16
|
-
</u-cell-item>
|
|
17
|
-
</u-cell-group>
|
|
18
|
-
</view>
|
|
19
|
-
</scroll-view>
|
|
20
|
-
</block>
|
|
21
|
-
<slot v-else />
|
|
22
|
-
</view>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup lang="ts">
|
|
26
|
-
import { ref, computed, onMounted, getCurrentInstance, useSlots, watch } from 'vue';
|
|
27
|
-
import { $u } from '../..';
|
|
28
|
-
import { DropdownItemProps } from './types';
|
|
29
|
-
|
|
30
|
-
defineOptions({ name: 'u-dropdown-item' });
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* dropdown-item 下拉菜单
|
|
34
|
-
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
35
|
-
* @tutorial https://uviewpro.cn/zh/components/dropdown.html
|
|
36
|
-
* @property {String | Number} v-model 双向绑定选项卡选择值
|
|
37
|
-
* @property {String} title 菜单项标题
|
|
38
|
-
* @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
|
|
39
|
-
* @property {Boolean} disabled 是否禁用此选项卡(默认false)
|
|
40
|
-
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
|
|
41
|
-
* @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
|
|
42
|
-
* @example <u-dropdown-item title="标题"></u-dropdown-item>
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
// props 定义
|
|
46
|
-
const props = defineProps(DropdownItemProps);
|
|
47
|
-
|
|
48
|
-
// emits 定义
|
|
49
|
-
const emit = defineEmits(['update:modelValue', 'change']);
|
|
50
|
-
|
|
51
|
-
// 插槽
|
|
52
|
-
const slots = useSlots();
|
|
53
|
-
|
|
54
|
-
// 当前项是否处于展开状态
|
|
55
|
-
const active = ref(false);
|
|
56
|
-
// 激活时左边文字和右边对勾图标的颜色
|
|
57
|
-
const activeColor = ref<string>('#2979ff');
|
|
58
|
-
// 未激活时左边文字和右边对勾图标的颜色
|
|
59
|
-
const inactiveColor = ref<string>('#606266');
|
|
60
|
-
// 父组件实例
|
|
61
|
-
const parent = ref<any>(null);
|
|
62
|
-
|
|
63
|
-
// 监听props变化,通知父组件重新初始化
|
|
64
|
-
const propsChange = computed(() => `${props.title}-${props.disabled}`);
|
|
65
|
-
|
|
66
|
-
// 监听propsChange变化,通知父组件重新init
|
|
67
|
-
watch(propsChange, () => {
|
|
68
|
-
if (parent.value && parent.value.init) parent.value.init();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 初始化本组件,注册到父组件
|
|
73
|
-
*/
|
|
74
|
-
function init() {
|
|
75
|
-
// 获取父组件u-dropdown
|
|
76
|
-
const instance = getCurrentInstance();
|
|
77
|
-
if (!instance) return;
|
|
78
|
-
const parentComp = $u.$parent('u-dropdown');
|
|
79
|
-
if (parentComp && parentComp.proxy) {
|
|
80
|
-
const parentProxy = parentComp.proxy as any;
|
|
81
|
-
parent.value = parentComp;
|
|
82
|
-
// 继承父组件的激活/未激活颜色
|
|
83
|
-
activeColor.value = parentProxy.activeColor;
|
|
84
|
-
inactiveColor.value = parentProxy.inactiveColor;
|
|
85
|
-
// 注册到父组件children
|
|
86
|
-
// 将本组件的this,放入到父组件的children数组中,让父组件可以操作本(子)组件的方法和属性
|
|
87
|
-
// push进去前,显判断是否已经存在了本实例,因为在子组件内部数据变化时,会通过父组件重新初始化子组件
|
|
88
|
-
const exist = parentComp?.exposed?.children.value.find((val: any) => val === instance);
|
|
89
|
-
if (!exist) parentComp?.exposed?.children.value.push(instance);
|
|
90
|
-
if (parentComp?.exposed?.children.value.length === 1) active.value = true;
|
|
91
|
-
// 向父组件menuList注册本项
|
|
92
|
-
// 父组件无法监听children的变化,故将子组件的title,传入父组件的menuList数组中
|
|
93
|
-
parentComp?.exposed?.menuList.value.push({ title: props.title, disabled: props.disabled });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* cell被点击
|
|
99
|
-
* @param value 选中值
|
|
100
|
-
*/
|
|
101
|
-
function cellClick(value: string | number | any) {
|
|
102
|
-
// 修改通过v-model绑定的值
|
|
103
|
-
emit('update:modelValue', value);
|
|
104
|
-
// 通知父组件(u-dropdown)收起菜单
|
|
105
|
-
parent.value?.exposed?.close();
|
|
106
|
-
// 发出事件,抛出当前勾选项的value
|
|
107
|
-
emit('change', value);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function setActive(value: boolean) {
|
|
111
|
-
active.value = value;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
onMounted(() => {
|
|
115
|
-
init();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
defineExpose({ init, cellClick, setActive });
|
|
119
|
-
</script>
|
|
120
|
-
|
|
121
|
-
<style scoped lang="scss">
|
|
122
|
-
@import '../../libs/css/style.components.scss';
|
|
123
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent @tap.stop.prevent>
|
|
3
|
+
<block v-if="!slots.default && !slots.$default">
|
|
4
|
+
<scroll-view scroll-y="true" :style="{ height: $u.addUnit(height) }">
|
|
5
|
+
<view class="u-dropdown-item__options">
|
|
6
|
+
<u-cell-group>
|
|
7
|
+
<u-cell-item
|
|
8
|
+
@click="cellClick(item.value)"
|
|
9
|
+
:arrow="false"
|
|
10
|
+
:title="item.label"
|
|
11
|
+
v-for="(item, index) in options"
|
|
12
|
+
:key="index"
|
|
13
|
+
:title-style="{ color: modelValue == item.value ? activeColor : inactiveColor }"
|
|
14
|
+
>
|
|
15
|
+
<u-icon v-if="modelValue == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
|
|
16
|
+
</u-cell-item>
|
|
17
|
+
</u-cell-group>
|
|
18
|
+
</view>
|
|
19
|
+
</scroll-view>
|
|
20
|
+
</block>
|
|
21
|
+
<slot v-else />
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import { ref, computed, onMounted, getCurrentInstance, useSlots, watch } from 'vue';
|
|
27
|
+
import { $u } from '../..';
|
|
28
|
+
import { DropdownItemProps } from './types';
|
|
29
|
+
|
|
30
|
+
defineOptions({ name: 'u-dropdown-item' });
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* dropdown-item 下拉菜单
|
|
34
|
+
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
35
|
+
* @tutorial https://uviewpro.cn/zh/components/dropdown.html
|
|
36
|
+
* @property {String | Number} v-model 双向绑定选项卡选择值
|
|
37
|
+
* @property {String} title 菜单项标题
|
|
38
|
+
* @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
|
|
39
|
+
* @property {Boolean} disabled 是否禁用此选项卡(默认false)
|
|
40
|
+
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
|
|
41
|
+
* @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
|
|
42
|
+
* @example <u-dropdown-item title="标题"></u-dropdown-item>
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
// props 定义
|
|
46
|
+
const props = defineProps(DropdownItemProps);
|
|
47
|
+
|
|
48
|
+
// emits 定义
|
|
49
|
+
const emit = defineEmits(['update:modelValue', 'change']);
|
|
50
|
+
|
|
51
|
+
// 插槽
|
|
52
|
+
const slots = useSlots();
|
|
53
|
+
|
|
54
|
+
// 当前项是否处于展开状态
|
|
55
|
+
const active = ref(false);
|
|
56
|
+
// 激活时左边文字和右边对勾图标的颜色
|
|
57
|
+
const activeColor = ref<string>('#2979ff');
|
|
58
|
+
// 未激活时左边文字和右边对勾图标的颜色
|
|
59
|
+
const inactiveColor = ref<string>('#606266');
|
|
60
|
+
// 父组件实例
|
|
61
|
+
const parent = ref<any>(null);
|
|
62
|
+
|
|
63
|
+
// 监听props变化,通知父组件重新初始化
|
|
64
|
+
const propsChange = computed(() => `${props.title}-${props.disabled}`);
|
|
65
|
+
|
|
66
|
+
// 监听propsChange变化,通知父组件重新init
|
|
67
|
+
watch(propsChange, () => {
|
|
68
|
+
if (parent.value && parent.value.init) parent.value.init();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 初始化本组件,注册到父组件
|
|
73
|
+
*/
|
|
74
|
+
function init() {
|
|
75
|
+
// 获取父组件u-dropdown
|
|
76
|
+
const instance = getCurrentInstance();
|
|
77
|
+
if (!instance) return;
|
|
78
|
+
const parentComp = $u.$parent('u-dropdown');
|
|
79
|
+
if (parentComp && parentComp.proxy) {
|
|
80
|
+
const parentProxy = parentComp.proxy as any;
|
|
81
|
+
parent.value = parentComp;
|
|
82
|
+
// 继承父组件的激活/未激活颜色
|
|
83
|
+
activeColor.value = parentProxy.activeColor;
|
|
84
|
+
inactiveColor.value = parentProxy.inactiveColor;
|
|
85
|
+
// 注册到父组件children
|
|
86
|
+
// 将本组件的this,放入到父组件的children数组中,让父组件可以操作本(子)组件的方法和属性
|
|
87
|
+
// push进去前,显判断是否已经存在了本实例,因为在子组件内部数据变化时,会通过父组件重新初始化子组件
|
|
88
|
+
const exist = parentComp?.exposed?.children.value.find((val: any) => val === instance);
|
|
89
|
+
if (!exist) parentComp?.exposed?.children.value.push(instance);
|
|
90
|
+
if (parentComp?.exposed?.children.value.length === 1) active.value = true;
|
|
91
|
+
// 向父组件menuList注册本项
|
|
92
|
+
// 父组件无法监听children的变化,故将子组件的title,传入父组件的menuList数组中
|
|
93
|
+
parentComp?.exposed?.menuList.value.push({ title: props.title, disabled: props.disabled });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* cell被点击
|
|
99
|
+
* @param value 选中值
|
|
100
|
+
*/
|
|
101
|
+
function cellClick(value: string | number | any) {
|
|
102
|
+
// 修改通过v-model绑定的值
|
|
103
|
+
emit('update:modelValue', value);
|
|
104
|
+
// 通知父组件(u-dropdown)收起菜单
|
|
105
|
+
parent.value?.exposed?.close();
|
|
106
|
+
// 发出事件,抛出当前勾选项的value
|
|
107
|
+
emit('change', value);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function setActive(value: boolean) {
|
|
111
|
+
active.value = value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
init();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
defineExpose({ init, cellClick, setActive });
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style scoped lang="scss">
|
|
122
|
+
@import '../../libs/css/style.components.scss';
|
|
123
|
+
</style>
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* u-empty 组件 Props 类型定义
|
|
5
|
-
*/
|
|
6
|
-
export const EmptyProps = {
|
|
7
|
-
/** 图标路径 */
|
|
8
|
-
src: { type: String, default: '' },
|
|
9
|
-
/** 提示文字 */
|
|
10
|
-
text: { type: String, default: '' },
|
|
11
|
-
/** 文字颜色 */
|
|
12
|
-
color: { type: String, default: '#c0c4cc' },
|
|
13
|
-
/** 图标的颜色 */
|
|
14
|
-
iconColor: { type: String, default: '#c0c4cc' },
|
|
15
|
-
/** 图标的大小 */
|
|
16
|
-
iconSize: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
17
|
-
/** 文字大小,单位rpx */
|
|
18
|
-
fontSize: { type: [String, Number] as PropType<string | number>, default: 26 },
|
|
19
|
-
/** 选择预置的图标类型 */
|
|
20
|
-
mode: { type: String, default: 'data' },
|
|
21
|
-
/** 图标宽度,单位rpx */
|
|
22
|
-
imgWidth: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
23
|
-
/** 图标高度,单位rpx */
|
|
24
|
-
imgHeight: { type: [String, Number] as PropType<string | number>, default: 'auto' },
|
|
25
|
-
/** 是否显示组件 */
|
|
26
|
-
show: { type: Boolean, default: true },
|
|
27
|
-
/** 组件距离上一个元素之间的距离 */
|
|
28
|
-
marginTop: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
29
|
-
/** 图标自定义样式 */
|
|
30
|
-
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* u-empty 组件 Props 类型
|
|
35
|
-
*/
|
|
36
|
-
export type EmptyProps = ExtractPropTypes<typeof EmptyProps>;
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* u-empty 组件 Props 类型定义
|
|
5
|
+
*/
|
|
6
|
+
export const EmptyProps = {
|
|
7
|
+
/** 图标路径 */
|
|
8
|
+
src: { type: String, default: '' },
|
|
9
|
+
/** 提示文字 */
|
|
10
|
+
text: { type: String, default: '' },
|
|
11
|
+
/** 文字颜色 */
|
|
12
|
+
color: { type: String, default: '#c0c4cc' },
|
|
13
|
+
/** 图标的颜色 */
|
|
14
|
+
iconColor: { type: String, default: '#c0c4cc' },
|
|
15
|
+
/** 图标的大小 */
|
|
16
|
+
iconSize: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
17
|
+
/** 文字大小,单位rpx */
|
|
18
|
+
fontSize: { type: [String, Number] as PropType<string | number>, default: 26 },
|
|
19
|
+
/** 选择预置的图标类型 */
|
|
20
|
+
mode: { type: String, default: 'data' },
|
|
21
|
+
/** 图标宽度,单位rpx */
|
|
22
|
+
imgWidth: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
23
|
+
/** 图标高度,单位rpx */
|
|
24
|
+
imgHeight: { type: [String, Number] as PropType<string | number>, default: 'auto' },
|
|
25
|
+
/** 是否显示组件 */
|
|
26
|
+
show: { type: Boolean, default: true },
|
|
27
|
+
/** 组件距离上一个元素之间的距离 */
|
|
28
|
+
marginTop: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
29
|
+
/** 图标自定义样式 */
|
|
30
|
+
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* u-empty 组件 Props 类型
|
|
35
|
+
*/
|
|
36
|
+
export type EmptyProps = ExtractPropTypes<typeof EmptyProps>;
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="u-empty" v-if="show" :style="{ marginTop: marginTop + 'rpx' }">
|
|
3
|
-
<u-icon
|
|
4
|
-
:name="src ? src : 'empty-' + mode"
|
|
5
|
-
:custom-style="iconStyle"
|
|
6
|
-
:label="text ? text : icons[mode]"
|
|
7
|
-
label-pos="bottom"
|
|
8
|
-
:label-color="color"
|
|
9
|
-
:label-size="fontSize"
|
|
10
|
-
:size="iconSize"
|
|
11
|
-
:color="iconColor"
|
|
12
|
-
margin-top="14"
|
|
13
|
-
></u-icon>
|
|
14
|
-
<view class="u-slot-wrap">
|
|
15
|
-
<slot name="bottom"></slot>
|
|
16
|
-
</view>
|
|
17
|
-
</view>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import { EmptyProps } from './types';
|
|
22
|
-
|
|
23
|
-
defineOptions({
|
|
24
|
-
name: 'u-empty'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* empty 内容为空
|
|
29
|
-
* @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
|
|
30
|
-
* @tutorial https://uviewpro.cn/zh/components/empty.html
|
|
31
|
-
* @property {String} color 文字颜色(默认#c0c4cc)
|
|
32
|
-
* @property {String} text 文字提示(默认“无内容”)
|
|
33
|
-
* @property {String} src 自定义图标路径,如定义,mode参数会失效
|
|
34
|
-
* @property {String Number} font-size 提示文字的大小,单位rpx(默认28)
|
|
35
|
-
* @property {String} mode 内置的图标,见官网说明(默认data)
|
|
36
|
-
* @property {String Number} img-width 图标的宽度,单位rpx(默认240)
|
|
37
|
-
* @property {String} img-height 图标的高度,单位rpx(默认auto)
|
|
38
|
-
* @property {String Number} margin-top 组件距离上一个元素之间的距离(默认0)
|
|
39
|
-
* @property {Boolean} show 是否显示组件(默认true)
|
|
40
|
-
* @event {Function} click 点击组件时触发
|
|
41
|
-
* @event {Function} close 点击关闭按钮时触发
|
|
42
|
-
* @example <u-empty text="所谓伊人,在水一方" mode="list"></u-empty>
|
|
43
|
-
*/
|
|
44
|
-
const props = defineProps(EmptyProps);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 预置图标对应的提示文字
|
|
48
|
-
*/
|
|
49
|
-
const icons: Record<string, string> = {
|
|
50
|
-
car: '购物车为空',
|
|
51
|
-
page: '页面不存在',
|
|
52
|
-
search: '没有搜索结果',
|
|
53
|
-
address: '没有收货地址',
|
|
54
|
-
wifi: '没有WiFi',
|
|
55
|
-
order: '订单为空',
|
|
56
|
-
coupon: '没有优惠券',
|
|
57
|
-
favor: '暂无收藏',
|
|
58
|
-
permission: '无权限',
|
|
59
|
-
history: '无历史记录',
|
|
60
|
-
news: '无新闻列表',
|
|
61
|
-
message: '消息列表为空',
|
|
62
|
-
list: '列表为空',
|
|
63
|
-
data: '数据为空'
|
|
64
|
-
};
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<style scoped lang="scss">
|
|
68
|
-
@import '../../libs/css/style.components.scss';
|
|
69
|
-
|
|
70
|
-
.u-empty {
|
|
71
|
-
@include vue-flex;
|
|
72
|
-
flex-direction: column;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
align-items: center;
|
|
75
|
-
height: 100%;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.u-image {
|
|
79
|
-
margin-bottom: 20rpx;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.u-slot-wrap {
|
|
83
|
-
@include vue-flex;
|
|
84
|
-
justify-content: center;
|
|
85
|
-
align-items: center;
|
|
86
|
-
margin-top: 20rpx;
|
|
87
|
-
}
|
|
88
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-empty" v-if="show" :style="{ marginTop: marginTop + 'rpx' }">
|
|
3
|
+
<u-icon
|
|
4
|
+
:name="src ? src : 'empty-' + mode"
|
|
5
|
+
:custom-style="iconStyle"
|
|
6
|
+
:label="text ? text : icons[mode]"
|
|
7
|
+
label-pos="bottom"
|
|
8
|
+
:label-color="color"
|
|
9
|
+
:label-size="fontSize"
|
|
10
|
+
:size="iconSize"
|
|
11
|
+
:color="iconColor"
|
|
12
|
+
margin-top="14"
|
|
13
|
+
></u-icon>
|
|
14
|
+
<view class="u-slot-wrap">
|
|
15
|
+
<slot name="bottom"></slot>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { EmptyProps } from './types';
|
|
22
|
+
|
|
23
|
+
defineOptions({
|
|
24
|
+
name: 'u-empty'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* empty 内容为空
|
|
29
|
+
* @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
|
|
30
|
+
* @tutorial https://uviewpro.cn/zh/components/empty.html
|
|
31
|
+
* @property {String} color 文字颜色(默认#c0c4cc)
|
|
32
|
+
* @property {String} text 文字提示(默认“无内容”)
|
|
33
|
+
* @property {String} src 自定义图标路径,如定义,mode参数会失效
|
|
34
|
+
* @property {String Number} font-size 提示文字的大小,单位rpx(默认28)
|
|
35
|
+
* @property {String} mode 内置的图标,见官网说明(默认data)
|
|
36
|
+
* @property {String Number} img-width 图标的宽度,单位rpx(默认240)
|
|
37
|
+
* @property {String} img-height 图标的高度,单位rpx(默认auto)
|
|
38
|
+
* @property {String Number} margin-top 组件距离上一个元素之间的距离(默认0)
|
|
39
|
+
* @property {Boolean} show 是否显示组件(默认true)
|
|
40
|
+
* @event {Function} click 点击组件时触发
|
|
41
|
+
* @event {Function} close 点击关闭按钮时触发
|
|
42
|
+
* @example <u-empty text="所谓伊人,在水一方" mode="list"></u-empty>
|
|
43
|
+
*/
|
|
44
|
+
const props = defineProps(EmptyProps);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 预置图标对应的提示文字
|
|
48
|
+
*/
|
|
49
|
+
const icons: Record<string, string> = {
|
|
50
|
+
car: '购物车为空',
|
|
51
|
+
page: '页面不存在',
|
|
52
|
+
search: '没有搜索结果',
|
|
53
|
+
address: '没有收货地址',
|
|
54
|
+
wifi: '没有WiFi',
|
|
55
|
+
order: '订单为空',
|
|
56
|
+
coupon: '没有优惠券',
|
|
57
|
+
favor: '暂无收藏',
|
|
58
|
+
permission: '无权限',
|
|
59
|
+
history: '无历史记录',
|
|
60
|
+
news: '无新闻列表',
|
|
61
|
+
message: '消息列表为空',
|
|
62
|
+
list: '列表为空',
|
|
63
|
+
data: '数据为空'
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style scoped lang="scss">
|
|
68
|
+
@import '../../libs/css/style.components.scss';
|
|
69
|
+
|
|
70
|
+
.u-empty {
|
|
71
|
+
@include vue-flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.u-image {
|
|
79
|
+
margin-bottom: 20rpx;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.u-slot-wrap {
|
|
83
|
+
@include vue-flex;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: center;
|
|
86
|
+
margin-top: 20rpx;
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type { InputAlign, InputConfirmType, InputLabelPosition, InputType } from '../../types/global';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* u-field 组件 Props 类型定义
|
|
6
|
-
* @description 表单输入框属性
|
|
7
|
-
*/
|
|
8
|
-
export const FieldProps = {
|
|
9
|
-
/** label左边的图标,限uView的图标名称 */
|
|
10
|
-
icon: String,
|
|
11
|
-
/** 输入框右边的图标名称,限uView的图标名称(默认false) */
|
|
12
|
-
rightIcon: String,
|
|
13
|
-
/** 方向属性 */
|
|
14
|
-
arrowDirection: { type: String, default: 'right' },
|
|
15
|
-
/** 是否必填,左边显示红色"*"号(默认false) */
|
|
16
|
-
required: Boolean,
|
|
17
|
-
/** 输入框左边的文字提示 */
|
|
18
|
-
label: String,
|
|
19
|
-
/** 是否密码输入方式(用点替换文字),type为text时有效(默认false) */
|
|
20
|
-
password: Boolean,
|
|
21
|
-
/** 是否显示右侧清空内容的图标控件(默认true) */
|
|
22
|
-
clearable: { type: Boolean, default: true },
|
|
23
|
-
/** label的宽度,单位rpx(默认130) */
|
|
24
|
-
labelWidth: { type: [Number, String] as PropType<string | number>, default: 130 },
|
|
25
|
-
/** label的文字对齐方式(默认left) */
|
|
26
|
-
labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
27
|
-
/** 输入框内容对齐方式(默认left) */
|
|
28
|
-
inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
29
|
-
/** 左边通过icon配置的图标的颜色(默认#606266) */
|
|
30
|
-
iconColor: { type: String, default: '#606266' },
|
|
31
|
-
/** 是否自动增高输入区域,type为textarea时有效(默认true) */
|
|
32
|
-
autoHeight: { type: Boolean, default: true },
|
|
33
|
-
/** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
|
|
34
|
-
errorMessage: { type: [String, Boolean] as PropType<string | boolean>, default: '' },
|
|
35
|
-
/** 输入框的提示文字 */
|
|
36
|
-
placeholder: String,
|
|
37
|
-
/** placeholder的样式(内联样式,字符串),如"color: #ddd" */
|
|
38
|
-
placeholderStyle: String,
|
|
39
|
-
/** 是否自动获得焦点(默认false) */
|
|
40
|
-
focus: Boolean,
|
|
41
|
-
/** 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false) */
|
|
42
|
-
fixed: Boolean,
|
|
43
|
-
/** 输入框绑定值 */
|
|
44
|
-
modelValue: [Number, String],
|
|
45
|
-
/** 输入框类型(text/textarea/password等,默认text) */
|
|
46
|
-
type: { type: String as PropType<InputType>, default: 'text' },
|
|
47
|
-
/** 是否不可输入(默认false) */
|
|
48
|
-
disabled: { type: Boolean, default: false },
|
|
49
|
-
/** 最大输入长度,设置为 -1 的时候不限制最大长度(默认140) */
|
|
50
|
-
maxlength: { type: [Number, String] as PropType<string | number>, default: 140 },
|
|
51
|
-
/** 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done) */
|
|
52
|
-
confirmType: { type: String as PropType<InputConfirmType>, default: 'done' },
|
|
53
|
-
/** label位置(默认left)left-左边,top-上边 */
|
|
54
|
-
labelPosition: { type: String as PropType<InputLabelPosition>, default: 'left' },
|
|
55
|
-
/** 自定义输入框的样式,对象形式 */
|
|
56
|
-
fieldStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
57
|
-
/** 清除图标的大小,单位rpx(默认30) */
|
|
58
|
-
clearSize: { type: [Number, String] as PropType<string | number>, default: 30 },
|
|
59
|
-
/** 左侧图标样式 */
|
|
60
|
-
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
61
|
-
/** 是否显示field的上边框(默认false) */
|
|
62
|
-
borderTop: { type: Boolean, default: false },
|
|
63
|
-
/** 是否显示field的下边框(默认true) */
|
|
64
|
-
borderBottom: { type: Boolean, default: true },
|
|
65
|
-
/** 是否自动去除输入内容首尾空格(默认true) */
|
|
66
|
-
trim: { type: Boolean, default: true }
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type FieldProps = ExtractPropTypes<typeof FieldProps>;
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { InputAlign, InputConfirmType, InputLabelPosition, InputType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* u-field 组件 Props 类型定义
|
|
6
|
+
* @description 表单输入框属性
|
|
7
|
+
*/
|
|
8
|
+
export const FieldProps = {
|
|
9
|
+
/** label左边的图标,限uView的图标名称 */
|
|
10
|
+
icon: String,
|
|
11
|
+
/** 输入框右边的图标名称,限uView的图标名称(默认false) */
|
|
12
|
+
rightIcon: String,
|
|
13
|
+
/** 方向属性 */
|
|
14
|
+
arrowDirection: { type: String, default: 'right' },
|
|
15
|
+
/** 是否必填,左边显示红色"*"号(默认false) */
|
|
16
|
+
required: Boolean,
|
|
17
|
+
/** 输入框左边的文字提示 */
|
|
18
|
+
label: String,
|
|
19
|
+
/** 是否密码输入方式(用点替换文字),type为text时有效(默认false) */
|
|
20
|
+
password: Boolean,
|
|
21
|
+
/** 是否显示右侧清空内容的图标控件(默认true) */
|
|
22
|
+
clearable: { type: Boolean, default: true },
|
|
23
|
+
/** label的宽度,单位rpx(默认130) */
|
|
24
|
+
labelWidth: { type: [Number, String] as PropType<string | number>, default: 130 },
|
|
25
|
+
/** label的文字对齐方式(默认left) */
|
|
26
|
+
labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
27
|
+
/** 输入框内容对齐方式(默认left) */
|
|
28
|
+
inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
29
|
+
/** 左边通过icon配置的图标的颜色(默认#606266) */
|
|
30
|
+
iconColor: { type: String, default: '#606266' },
|
|
31
|
+
/** 是否自动增高输入区域,type为textarea时有效(默认true) */
|
|
32
|
+
autoHeight: { type: Boolean, default: true },
|
|
33
|
+
/** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
|
|
34
|
+
errorMessage: { type: [String, Boolean] as PropType<string | boolean>, default: '' },
|
|
35
|
+
/** 输入框的提示文字 */
|
|
36
|
+
placeholder: String,
|
|
37
|
+
/** placeholder的样式(内联样式,字符串),如"color: #ddd" */
|
|
38
|
+
placeholderStyle: String,
|
|
39
|
+
/** 是否自动获得焦点(默认false) */
|
|
40
|
+
focus: Boolean,
|
|
41
|
+
/** 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false) */
|
|
42
|
+
fixed: Boolean,
|
|
43
|
+
/** 输入框绑定值 */
|
|
44
|
+
modelValue: [Number, String],
|
|
45
|
+
/** 输入框类型(text/textarea/password等,默认text) */
|
|
46
|
+
type: { type: String as PropType<InputType>, default: 'text' },
|
|
47
|
+
/** 是否不可输入(默认false) */
|
|
48
|
+
disabled: { type: Boolean, default: false },
|
|
49
|
+
/** 最大输入长度,设置为 -1 的时候不限制最大长度(默认140) */
|
|
50
|
+
maxlength: { type: [Number, String] as PropType<string | number>, default: 140 },
|
|
51
|
+
/** 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done) */
|
|
52
|
+
confirmType: { type: String as PropType<InputConfirmType>, default: 'done' },
|
|
53
|
+
/** label位置(默认left)left-左边,top-上边 */
|
|
54
|
+
labelPosition: { type: String as PropType<InputLabelPosition>, default: 'left' },
|
|
55
|
+
/** 自定义输入框的样式,对象形式 */
|
|
56
|
+
fieldStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
57
|
+
/** 清除图标的大小,单位rpx(默认30) */
|
|
58
|
+
clearSize: { type: [Number, String] as PropType<string | number>, default: 30 },
|
|
59
|
+
/** 左侧图标样式 */
|
|
60
|
+
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
61
|
+
/** 是否显示field的上边框(默认false) */
|
|
62
|
+
borderTop: { type: Boolean, default: false },
|
|
63
|
+
/** 是否显示field的下边框(默认true) */
|
|
64
|
+
borderBottom: { type: Boolean, default: true },
|
|
65
|
+
/** 是否自动去除输入内容首尾空格(默认true) */
|
|
66
|
+
trim: { type: Boolean, default: true }
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type FieldProps = ExtractPropTypes<typeof FieldProps>;
|