hy-app 0.5.4 → 0.5.6
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/components/hy-action-sheet/typing.d.ts +1 -63
- package/components/hy-address-picker/hy-address-picker.vue +7 -6
- package/components/hy-address-picker/typing.d.ts +0 -84
- package/components/hy-avatar/typing.d.ts +0 -66
- package/components/hy-back-top/props.ts +2 -3
- package/components/hy-back-top/typing.d.ts +0 -47
- package/components/hy-badge/props.ts +1 -1
- package/components/hy-badge/typing.d.ts +3 -60
- package/components/hy-button/props.ts +1 -1
- package/components/hy-button/typing.d.ts +28 -162
- package/components/hy-calendar/hy-calendar.vue +2 -2
- package/components/hy-calendar/typing.d.ts +0 -128
- package/components/hy-card/hy-card.vue +14 -13
- package/components/hy-card/props.ts +4 -6
- package/components/hy-card/typing.d.ts +1 -114
- package/components/hy-cell/hy-cell.vue +9 -190
- package/components/hy-cell/props.ts +7 -26
- package/components/hy-cell/typing.d.ts +2 -96
- package/components/hy-cell-item/hy-cell-item.vue +160 -0
- package/components/hy-cell-item/index.scss +100 -0
- package/components/hy-cell-item/props.ts +66 -0
- package/components/hy-cell-item/typing.d.ts +7 -0
- package/components/hy-check-button/typing.d.ts +0 -43
- package/components/hy-checkbox/typing.d.ts +1 -73
- package/components/hy-checkbox-group/props.ts +1 -1
- package/components/hy-checkbox-group/typing.d.ts +0 -65
- package/components/hy-checkbox-item/typing.d.ts +3 -3
- package/components/hy-code-input/typing.d.ts +0 -70
- package/components/hy-count-down/typing.d.ts +1 -20
- package/components/hy-count-to/typing.d.ts +0 -47
- package/components/hy-coupon/typing.d.ts +0 -133
- package/components/hy-datetime-picker/typing.d.ts +0 -119
- package/components/hy-dropdown-item/typing.d.ts +12 -31
- package/components/hy-empty/typing.d.ts +1 -59
- package/components/hy-float-button/typing.d.ts +24 -113
- package/components/hy-form/typing.d.ts +0 -27
- package/components/hy-form-item/hy-form-item.vue +7 -5
- package/components/hy-form-item/typing.d.ts +0 -19
- package/components/hy-grid/props.ts +1 -1
- package/components/hy-grid/typing.d.ts +1 -45
- package/components/hy-icon/props.ts +1 -1
- package/components/hy-icon/typing.d.ts +3 -84
- package/components/hy-image/typing.d.ts +0 -80
- package/components/hy-input/hy-input.vue +19 -22
- package/components/hy-input/props.ts +1 -1
- package/components/hy-input/typing.d.ts +0 -149
- package/components/hy-list/typing.d.ts +0 -51
- package/components/hy-menu/props.ts +2 -2
- package/components/hy-menu/typing.d.ts +0 -35
- package/components/hy-modal/typing.d.ts +9 -84
- package/components/hy-navbar/typing.d.ts +0 -81
- package/components/hy-notice-bar/typing.d.ts +0 -65
- package/components/hy-number-step/props.ts +1 -1
- package/components/hy-number-step/typing.d.ts +0 -110
- package/components/hy-overlay/typing.d.ts +2 -27
- package/components/hy-pagination/typing.d.ts +6 -49
- package/components/hy-picker/typing.d.ts +27 -124
- package/components/hy-popover/typing.d.ts +25 -66
- package/components/hy-popup/typing.d.ts +8 -77
- package/components/hy-price/hy-price.vue +9 -2
- package/components/hy-price/typing.d.ts +0 -41
- package/components/hy-qrcode/hy-qrcode.vue +3 -4
- package/components/hy-qrcode/index.scss +3 -3
- package/components/hy-qrcode/qrcode.js +0 -138
- package/components/hy-qrcode/typing.d.ts +0 -66
- package/components/hy-radio/typing.d.ts +1 -86
- package/components/hy-rate/typing.d.ts +0 -62
- package/components/hy-read-more/typing.d.ts +4 -49
- package/components/hy-scroll-list/typing.d.ts +4 -33
- package/components/hy-search/props.ts +1 -2
- package/components/hy-search/typing.d.ts +19 -120
- package/components/hy-signature/typing.d.ts +0 -101
- package/components/hy-slider/typing.d.ts +8 -77
- package/components/hy-steps/typing.d.ts +16 -60
- package/components/hy-submit-bar/typing.d.ts +0 -72
- package/components/hy-subsection/typing.d.ts +0 -49
- package/components/hy-swipe-action/index.ts +13 -22
- package/components/hy-swipe-action/typing.d.ts +1 -38
- package/components/hy-swiper/typing.d.ts +0 -101
- package/components/hy-switch/props.ts +1 -1
- package/components/hy-switch/typing.d.ts +0 -62
- package/components/hy-tabbar/index.scss +1 -1
- package/components/hy-tabbar/props.ts +1 -1
- package/components/hy-tabbar/typing.d.ts +0 -40
- package/components/hy-tabbar-group/props.ts +1 -1
- package/components/hy-tabbar-item/typing.ts +0 -12
- package/components/hy-tabs/props.ts +1 -1
- package/components/hy-tabs/typing.d.ts +25 -92
- package/components/hy-tag/props.ts +1 -1
- package/components/hy-tag/typing.d.ts +9 -78
- package/components/hy-text/typing.d.ts +3 -100
- package/components/hy-textarea/typing.d.ts +0 -27
- package/components/hy-tooltip/props.ts +0 -1
- package/components/hy-tooltip/typing.d.ts +2 -55
- package/components/hy-transition/typing.d.ts +14 -43
- package/components/hy-upload/typing.d.ts +56 -164
- package/components/hy-warn/typing.d.ts +4 -45
- package/global.d.ts +1 -0
- package/libs/css/theme.scss +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-card/index.scss +0 -57
- package/components/hy-cell/index.scss +0 -136
- package/components/hy-config-provider/typing.d.ts +0 -24
- package/components/hy-divider/typing.d.ts +0 -64
- package/components/hy-dropdown/typing.d.ts +0 -48
- package/components/hy-form-group/typing.d.ts +0 -0
- package/components/hy-line/typing.d.ts +0 -32
- package/components/hy-line-progress/typing.d.ts +0 -32
- package/components/hy-loading/typing.d.ts +0 -52
- package/components/hy-notify/typing.d.ts +0 -48
- package/components/hy-status-bar/typing.d.ts +0 -12
- package/components/hy-tabbar-group/README.md +0 -326
- package/components/hy-waterfall/typing.d.ts +0 -14
- package/components/hy-watermark/typing.d.ts +0 -76
|
@@ -33,33 +33,6 @@ export interface FormItemRule {
|
|
|
33
33
|
[key: string]: FormRule | FormRule[]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export default interface HyFormSimpleProps {
|
|
37
|
-
/**
|
|
38
|
-
* 表单数据对象
|
|
39
|
-
*/
|
|
40
|
-
model?: Record<string, any>
|
|
41
|
-
/**
|
|
42
|
-
* 验证规则
|
|
43
|
-
*/
|
|
44
|
-
rules?: FormItemRule
|
|
45
|
-
/**
|
|
46
|
-
* 标签宽度
|
|
47
|
-
*/
|
|
48
|
-
labelWidth?: string | number
|
|
49
|
-
/**
|
|
50
|
-
* 标签位置
|
|
51
|
-
*/
|
|
52
|
-
labelPosition?: 'left' | 'top'
|
|
53
|
-
/**
|
|
54
|
-
* 标签对齐方式
|
|
55
|
-
*/
|
|
56
|
-
labelAlign?: 'left' | 'center' | 'right'
|
|
57
|
-
/**
|
|
58
|
-
* 表单列底部边框
|
|
59
|
-
* */
|
|
60
|
-
border: boolean
|
|
61
|
-
}
|
|
62
|
-
|
|
63
36
|
export interface IFormEmits {
|
|
64
37
|
/** 提交表单 */
|
|
65
38
|
(e: 'submit', data: FormRule): void
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
<text v-if="isRequired" class="hy-form-item__label--required">*</text>
|
|
5
5
|
{{ label }}
|
|
6
6
|
</view>
|
|
7
|
-
<view
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<view class="hy-form-item__content">
|
|
8
|
+
<view :class="[formContext.border.value && 'hy-border__bottom']">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</view>
|
|
11
|
+
<view v-if="errorMessage" class="hy-form-item__error">
|
|
12
|
+
{{ errorMessage }}
|
|
13
|
+
</view>
|
|
12
14
|
</view>
|
|
13
15
|
</view>
|
|
14
16
|
</template>
|
|
@@ -22,25 +22,6 @@ export interface FormItemContext {
|
|
|
22
22
|
handleChange: (value: string | number) => void
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export default interface HyFormItemProps {
|
|
26
|
-
/**
|
|
27
|
-
* 标签文本
|
|
28
|
-
*/
|
|
29
|
-
label?: string
|
|
30
|
-
/**
|
|
31
|
-
* 表单字段名
|
|
32
|
-
*/
|
|
33
|
-
prop?: string
|
|
34
|
-
/**
|
|
35
|
-
* 是否必填
|
|
36
|
-
*/
|
|
37
|
-
required?: boolean
|
|
38
|
-
/**
|
|
39
|
-
* 验证规则
|
|
40
|
-
*/
|
|
41
|
-
rules?: any
|
|
42
|
-
}
|
|
43
|
-
|
|
44
25
|
export interface IFormItemEmits {
|
|
45
26
|
/** 提交表单 */
|
|
46
27
|
(e: 'change', value: any): void
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
1
|
+
import type { HyIconProps } from '../hy-icon/typing'
|
|
3
2
|
|
|
4
3
|
export interface GridItemVo {
|
|
5
4
|
/**
|
|
@@ -30,49 +29,6 @@ export interface CustomKeysVo {
|
|
|
30
29
|
icon: string
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
export default interface HyGridProps {
|
|
34
|
-
/**
|
|
35
|
-
* @description 数据集
|
|
36
|
-
* */
|
|
37
|
-
list: GridItemVo[]
|
|
38
|
-
/**
|
|
39
|
-
* @description 自定义键值
|
|
40
|
-
* */
|
|
41
|
-
customKeys?: CustomKeysVo
|
|
42
|
-
/**
|
|
43
|
-
* @description 宫格的列数(默认 3 )
|
|
44
|
-
* */
|
|
45
|
-
col?: number
|
|
46
|
-
/**
|
|
47
|
-
* @description 是否显示宫格的边框(默认 false )
|
|
48
|
-
* */
|
|
49
|
-
border?: boolean
|
|
50
|
-
/**
|
|
51
|
-
* @description 单个宫格高度(默认 60px )
|
|
52
|
-
* */
|
|
53
|
-
itemHeight?: number | string
|
|
54
|
-
/**
|
|
55
|
-
* @description 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右 (默认 'left' )
|
|
56
|
-
* */
|
|
57
|
-
align?: 'center' | HyApp.LeftRightType
|
|
58
|
-
/**
|
|
59
|
-
* @description 间隔(默认 0px)
|
|
60
|
-
* */
|
|
61
|
-
gap?: number | string
|
|
62
|
-
/**
|
|
63
|
-
* @description 宫格的背景颜色 (默认 'transparent' )
|
|
64
|
-
* */
|
|
65
|
-
bgColor?: string
|
|
66
|
-
/**
|
|
67
|
-
* @description 图标属性api配置集合
|
|
68
|
-
* */
|
|
69
|
-
iconConfig?: Partial<HyIconProps>
|
|
70
|
-
/**
|
|
71
|
-
* @description 定义需要用到的外部样式
|
|
72
|
-
* */
|
|
73
|
-
customStyle?: CSSProperties
|
|
74
|
-
}
|
|
75
|
-
|
|
76
32
|
export interface IGridEmits {
|
|
77
33
|
/** 点击小菜单触发 */
|
|
78
34
|
(e: 'click', name: string | Record<string, any>): void
|
|
@@ -1,88 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import iconProps from './props'
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* @description 图标名称,见示例图标集
|
|
6
|
-
* */
|
|
7
|
-
name: string | HyIconConfig
|
|
8
|
-
/**
|
|
9
|
-
* @description 图标颜色
|
|
10
|
-
* */
|
|
11
|
-
color?: string
|
|
12
|
-
/**
|
|
13
|
-
* @description 图标字体大小,单位px (默认 '16px' )
|
|
14
|
-
* */
|
|
15
|
-
size?: string | number
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description 是否显示粗体 (默认 false )
|
|
19
|
-
* */
|
|
20
|
-
bold?: boolean
|
|
21
|
-
/**
|
|
22
|
-
* @description 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
|
|
23
|
-
* */
|
|
24
|
-
index?: string | number
|
|
25
|
-
/**
|
|
26
|
-
* @description 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'hy-icon' )
|
|
27
|
-
* */
|
|
28
|
-
customPrefix?: string
|
|
29
|
-
/**
|
|
30
|
-
* @description 图标右侧的label文字
|
|
31
|
-
* */
|
|
32
|
-
label?: string
|
|
33
|
-
/**
|
|
34
|
-
* @description label相对于图标的位置,只能right或bottom (默认 'right' )
|
|
35
|
-
* */
|
|
36
|
-
labelPos?: 'right' | 'bottom'
|
|
37
|
-
/**
|
|
38
|
-
* @description label字体大小,单位px (默认 '15px' )
|
|
39
|
-
* */
|
|
40
|
-
labelSize?: string | number
|
|
41
|
-
/**
|
|
42
|
-
* @description 图标右侧的label文字颜色
|
|
43
|
-
* */
|
|
44
|
-
labelColor?: string
|
|
45
|
-
/**
|
|
46
|
-
* @description label与图标的距离,单位px (默认 '3px' )
|
|
47
|
-
* */
|
|
48
|
-
space?: string | number
|
|
49
|
-
/**
|
|
50
|
-
* @description 图片的mode
|
|
51
|
-
* */
|
|
52
|
-
imgMode?: string
|
|
53
|
-
/**
|
|
54
|
-
* @description 显示图片小图标时的宽度
|
|
55
|
-
* */
|
|
56
|
-
width?: string | number
|
|
57
|
-
/**
|
|
58
|
-
* @description 显示图片小图标时的高度
|
|
59
|
-
* */
|
|
60
|
-
height?: string | number
|
|
61
|
-
/**
|
|
62
|
-
* @description 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 )
|
|
63
|
-
* */
|
|
64
|
-
top?: number | string
|
|
65
|
-
/**
|
|
66
|
-
* @description 是否阻止事件传播 (默认 false )
|
|
67
|
-
* */
|
|
68
|
-
stop?: boolean
|
|
69
|
-
/**
|
|
70
|
-
* @description 是否旋转 (默认 false )
|
|
71
|
-
* */
|
|
72
|
-
isRotate?: boolean
|
|
73
|
-
/**
|
|
74
|
-
* @description 图标圆角
|
|
75
|
-
* */
|
|
76
|
-
round?: string | number
|
|
77
|
-
/**
|
|
78
|
-
* @description 自定义样式
|
|
79
|
-
* */
|
|
80
|
-
customStyle?: CSSProperties
|
|
81
|
-
/**
|
|
82
|
-
* @description 自定义类名
|
|
83
|
-
* */
|
|
84
|
-
customClass?: string
|
|
85
|
-
}
|
|
4
|
+
export interface HyIconProps extends ExtractPropTypes<typeof iconProps> {}
|
|
86
5
|
|
|
87
6
|
export interface IIconEmits {
|
|
88
7
|
/** 点击图标触发 */
|
|
@@ -1,85 +1,5 @@
|
|
|
1
|
-
import type { CSSProperties } from 'vue'
|
|
2
1
|
import type { ImageOnErrorEvent, ImageOnLoadEvent } from '@uni-helper/uni-types'
|
|
3
2
|
|
|
4
|
-
export default interface HyImageProps {
|
|
5
|
-
/**
|
|
6
|
-
* @description 图片地址
|
|
7
|
-
* */
|
|
8
|
-
src?: string
|
|
9
|
-
/**
|
|
10
|
-
* @description 裁剪模式,见官网说明 (默认 'aspectFill' )
|
|
11
|
-
* */
|
|
12
|
-
mode?: HyApp.ImageModeVo
|
|
13
|
-
/**
|
|
14
|
-
* @description 宽度,单位任意,如果为数值,则为px单位 (默认 '300' )
|
|
15
|
-
* */
|
|
16
|
-
width?: string | number
|
|
17
|
-
/**
|
|
18
|
-
* @description 高度,单位任意,如果为数值,则为px单位 (默认 '225' )
|
|
19
|
-
* */
|
|
20
|
-
height?: string | number
|
|
21
|
-
/**
|
|
22
|
-
* @description 图片形状,circle-圆形,square-方形 (默认 'square' )
|
|
23
|
-
* */
|
|
24
|
-
shape?: HyApp.ShapeType
|
|
25
|
-
/**
|
|
26
|
-
* @description 圆角值,单位任意,如果为数值,则为px单位 (默认 0 )
|
|
27
|
-
* */
|
|
28
|
-
radius?: number | string
|
|
29
|
-
/**
|
|
30
|
-
* @description 是否懒加载,仅微信小程序、App、百度小程序、字节跳动小程序有效 (默认 true )
|
|
31
|
-
* */
|
|
32
|
-
lazyLoad?: boolean
|
|
33
|
-
/**
|
|
34
|
-
* @description 是否开启长按图片显示识别小程序码菜单,仅微信小程序有效 (默认 true )
|
|
35
|
-
* */
|
|
36
|
-
showMenuByLongPress?: boolean
|
|
37
|
-
/**
|
|
38
|
-
* @description 加载中的图标,或者小图片 (默认 'photo' )
|
|
39
|
-
* */
|
|
40
|
-
loadingIcon?: string
|
|
41
|
-
/**
|
|
42
|
-
* @description 加载失败的图标,或者小图片 (默认 'error-circle' )
|
|
43
|
-
* */
|
|
44
|
-
errorIcon?: string
|
|
45
|
-
/**
|
|
46
|
-
* @description 是否显示加载中的图标或者自定义的slot (默认 true )
|
|
47
|
-
* */
|
|
48
|
-
showLoading?: boolean
|
|
49
|
-
/**
|
|
50
|
-
* @description 是否显示加载错误的图标或者自定义的slot (默认 true )
|
|
51
|
-
* */
|
|
52
|
-
showError?: boolean
|
|
53
|
-
/**
|
|
54
|
-
* @description 是否需要淡入效果 (默认 true )
|
|
55
|
-
* */
|
|
56
|
-
fade?: boolean
|
|
57
|
-
/**
|
|
58
|
-
* @description 只支持网络资源,只对微信小程序有效 (默认 false )
|
|
59
|
-
* */
|
|
60
|
-
webp?: boolean
|
|
61
|
-
/**
|
|
62
|
-
* @description 搭配fade参数的过渡时间,单位ms (默认 500 )
|
|
63
|
-
* */
|
|
64
|
-
duration?: number
|
|
65
|
-
/**
|
|
66
|
-
* @description 背景颜色,用于深色页面加载图片时,为了和背景色融合 (默认 '#f3f4f6' )
|
|
67
|
-
* */
|
|
68
|
-
bgColor?: string
|
|
69
|
-
/**
|
|
70
|
-
* @description 是否模糊图片 (默认 false )
|
|
71
|
-
* */
|
|
72
|
-
indistinct?: boolean
|
|
73
|
-
/**
|
|
74
|
-
* @description 是否预览图片 (默认 false )
|
|
75
|
-
* */
|
|
76
|
-
previewImage?: boolean
|
|
77
|
-
/**
|
|
78
|
-
* @description 定义需要用到的外部样式
|
|
79
|
-
* */
|
|
80
|
-
customStyle?: CSSProperties
|
|
81
|
-
}
|
|
82
|
-
|
|
83
3
|
export interface IImageEmits {
|
|
84
4
|
/** 点击触发 */
|
|
85
5
|
(e: 'click'): void
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
:type="type"
|
|
41
41
|
:focus="focus"
|
|
42
42
|
:cursor="cursor"
|
|
43
|
-
:value="
|
|
43
|
+
:value="innerValue"
|
|
44
44
|
:auto-blur="autoBlur"
|
|
45
45
|
:disabled="disabled || readonly"
|
|
46
46
|
:maxlength="maxlength"
|
|
@@ -148,13 +148,14 @@ const innerFormatter = (value: string) => value
|
|
|
148
148
|
watch(
|
|
149
149
|
() => props.modelValue,
|
|
150
150
|
(newVal) => {
|
|
151
|
-
if (changeFromInner.value || innerValue.value === newVal) {
|
|
152
|
-
changeFromInner.value = false
|
|
151
|
+
if (changeFromInner.value || innerValue.value === newVal || newVal === undefined) {
|
|
152
|
+
changeFromInner.value = false
|
|
153
153
|
return
|
|
154
154
|
}
|
|
155
|
+
console.log(newVal, 'newVal')
|
|
155
156
|
innerValue.value = newVal
|
|
156
157
|
// 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
|
|
157
|
-
if (firstChange.value
|
|
158
|
+
if (!firstChange.value && !changeFromInner.value) {
|
|
158
159
|
valueChange(innerValue.value, true)
|
|
159
160
|
}
|
|
160
161
|
firstChange.value = false
|
|
@@ -165,14 +166,14 @@ watch(
|
|
|
165
166
|
)
|
|
166
167
|
|
|
167
168
|
/**
|
|
168
|
-
*
|
|
169
|
+
* 是否显示清除控件
|
|
169
170
|
* */
|
|
170
171
|
const isShowClear = computed(() => {
|
|
171
172
|
const { clearable, readonly, disabled } = props
|
|
172
173
|
return clearable && !readonly && !disabled && innerValue.value !== ''
|
|
173
174
|
})
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
176
|
+
* 组件的类名
|
|
176
177
|
* */
|
|
177
178
|
const inputClass = computed((): string => {
|
|
178
179
|
let classes: string[] = [],
|
|
@@ -185,7 +186,7 @@ const inputClass = computed((): string => {
|
|
|
185
186
|
})
|
|
186
187
|
|
|
187
188
|
/**
|
|
188
|
-
*
|
|
189
|
+
* 组件的样式
|
|
189
190
|
* */
|
|
190
191
|
const wrapperStyle = computed((): CSSProperties => {
|
|
191
192
|
const style: CSSProperties = {}
|
|
@@ -200,9 +201,9 @@ const wrapperStyle = computed((): CSSProperties => {
|
|
|
200
201
|
return Object.assign(style, props.customStyle)
|
|
201
202
|
})
|
|
202
203
|
/**
|
|
203
|
-
*
|
|
204
|
+
* 输入框的样式
|
|
204
205
|
* */
|
|
205
|
-
const inputStyle = computed(()
|
|
206
|
+
const inputStyle = computed(() => {
|
|
206
207
|
return {
|
|
207
208
|
color: props.color,
|
|
208
209
|
fontSize: addUnit(props.fontSize),
|
|
@@ -211,7 +212,7 @@ const inputStyle = computed((): CSSProperties => {
|
|
|
211
212
|
})
|
|
212
213
|
|
|
213
214
|
/**
|
|
214
|
-
*
|
|
215
|
+
* 边框颜色
|
|
215
216
|
* */
|
|
216
217
|
const borderStyle = computed(() => {
|
|
217
218
|
return (isFocus: boolean) => {
|
|
@@ -233,13 +234,10 @@ const borderStyle = computed(() => {
|
|
|
233
234
|
})
|
|
234
235
|
|
|
235
236
|
/**
|
|
236
|
-
*
|
|
237
|
+
* 当键盘输入时,触发input事件
|
|
237
238
|
*/
|
|
238
239
|
const onInput = (e: any) => {
|
|
239
240
|
let { value = '' } = e.detail || {}
|
|
240
|
-
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
241
|
-
// console.log('onInput', value, this.innerValue)
|
|
242
|
-
innerValue.value = value
|
|
243
241
|
nextTick(() => {
|
|
244
242
|
let formatValue = innerFormatter(value)
|
|
245
243
|
innerValue.value = formatValue
|
|
@@ -247,7 +245,7 @@ const onInput = (e: any) => {
|
|
|
247
245
|
})
|
|
248
246
|
}
|
|
249
247
|
/**
|
|
250
|
-
*
|
|
248
|
+
* 输入框失去焦点时触发
|
|
251
249
|
* */
|
|
252
250
|
const onBlur = async (event: InputOnBlurEvent) => {
|
|
253
251
|
emit('blur', event, event.detail.value)
|
|
@@ -256,7 +254,7 @@ const onBlur = async (event: InputOnBlurEvent) => {
|
|
|
256
254
|
focused.value = false
|
|
257
255
|
}
|
|
258
256
|
/**
|
|
259
|
-
*
|
|
257
|
+
* 输入框聚焦时触发
|
|
260
258
|
* */
|
|
261
259
|
const onFocus = (e: InputOnFocusEvent) => {
|
|
262
260
|
focused.value = true
|
|
@@ -264,7 +262,7 @@ const onFocus = (e: InputOnFocusEvent) => {
|
|
|
264
262
|
}
|
|
265
263
|
|
|
266
264
|
/**
|
|
267
|
-
*
|
|
265
|
+
* 点击完成按钮时触发
|
|
268
266
|
* */
|
|
269
267
|
const onConfirm = (e: InputOnConfirmEvent) => {
|
|
270
268
|
emit('confirm', e, innerValue.value)
|
|
@@ -288,15 +286,14 @@ const valueChange = (value: string | number, isOut = false) => {
|
|
|
288
286
|
if (!isOut || clearInput.value) {
|
|
289
287
|
// 标识value值的变化是由内部引起的
|
|
290
288
|
changeFromInner.value = true
|
|
289
|
+
emit('update:modelValue', value)
|
|
291
290
|
emit('change', value)
|
|
292
291
|
if (formItem) formItem.handleChange(value)
|
|
293
|
-
|
|
294
|
-
emit('update:modelValue', value)
|
|
295
292
|
}
|
|
296
293
|
})
|
|
297
294
|
}
|
|
298
295
|
/**
|
|
299
|
-
*
|
|
296
|
+
* 点击清除控件
|
|
300
297
|
*/
|
|
301
298
|
const onClear = () => {
|
|
302
299
|
clearInput.value = true
|
|
@@ -319,13 +316,13 @@ const clickHandler = () => {
|
|
|
319
316
|
}
|
|
320
317
|
|
|
321
318
|
/**
|
|
322
|
-
*
|
|
319
|
+
* 点击前缀
|
|
323
320
|
* */
|
|
324
321
|
const onPrefix = () => {
|
|
325
322
|
emit('onPrefix')
|
|
326
323
|
}
|
|
327
324
|
/**
|
|
328
|
-
*
|
|
325
|
+
* 点击后缀
|
|
329
326
|
* */
|
|
330
327
|
const onSuffix = () => {
|
|
331
328
|
emit('onSuffix')
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { CSSProperties } from 'vue'
|
|
2
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
3
1
|
import type {
|
|
4
2
|
InputOnBlurEvent,
|
|
5
3
|
InputOnConfirmEvent,
|
|
@@ -7,153 +5,6 @@ import type {
|
|
|
7
5
|
InputOnKeyboardheightchange
|
|
8
6
|
} from '@uni-helper/uni-types'
|
|
9
7
|
|
|
10
|
-
export default interface HyInputProps {
|
|
11
|
-
/**
|
|
12
|
-
* @description 输入的值
|
|
13
|
-
* */
|
|
14
|
-
modelValue: string | number
|
|
15
|
-
/**
|
|
16
|
-
* @description 输入框类型,见上方说明 ( 默认 'text' )
|
|
17
|
-
* */
|
|
18
|
-
type?: HyApp.InputType
|
|
19
|
-
/**
|
|
20
|
-
* @description 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序 ( 默认 false )
|
|
21
|
-
* */
|
|
22
|
-
fixed?: boolean
|
|
23
|
-
/**
|
|
24
|
-
* @description 是否禁用输入框 ( 默认 false )
|
|
25
|
-
* */
|
|
26
|
-
disabled?: boolean
|
|
27
|
-
/**
|
|
28
|
-
* @description 禁用状态时的背景色( 默认 '#f5f7fa' )
|
|
29
|
-
* */
|
|
30
|
-
disabledColor?: string
|
|
31
|
-
/**
|
|
32
|
-
* @description 是否显示清除控件 ( 默认 false )
|
|
33
|
-
* */
|
|
34
|
-
clearable?: boolean
|
|
35
|
-
/**
|
|
36
|
-
* @description 是否密码类型 ( 默认 false )
|
|
37
|
-
* */
|
|
38
|
-
password?: boolean
|
|
39
|
-
/**
|
|
40
|
-
* @description 最大输入长度,设置为 -1 的时候不限制最大长度 ( 默认 -1 )
|
|
41
|
-
* */
|
|
42
|
-
maxlength?: number
|
|
43
|
-
/**
|
|
44
|
-
* @description 输入框为空时的占位符
|
|
45
|
-
* */
|
|
46
|
-
placeholder?: string | null
|
|
47
|
-
/**
|
|
48
|
-
* @description 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ ( 默认 'input-placeholder' )
|
|
49
|
-
* */
|
|
50
|
-
placeholderClass?: string
|
|
51
|
-
/**
|
|
52
|
-
* @description 指定placeholder的样式,字符串/对象形式,如"color: red;"
|
|
53
|
-
* */
|
|
54
|
-
placeholderStyle?: CSSProperties
|
|
55
|
-
/**
|
|
56
|
-
* @description 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效 ( 默认 false )
|
|
57
|
-
* */
|
|
58
|
-
showWordLimit?: boolean
|
|
59
|
-
/**
|
|
60
|
-
* @description 设置右下角按钮的文字,兼容性详见uni-app文档 ( 默认 'done' )
|
|
61
|
-
* */
|
|
62
|
-
confirmType?: string
|
|
63
|
-
/**
|
|
64
|
-
* @description 点击键盘右下角按钮时是否保持键盘不收起,H5无效 ( 默认 false )
|
|
65
|
-
* */
|
|
66
|
-
confirmHold?: boolean
|
|
67
|
-
/**
|
|
68
|
-
* @description focus时,点击页面的时候不收起键盘,微信小程序有效 ( 默认 false )
|
|
69
|
-
* */
|
|
70
|
-
holdKeyboard?: boolean
|
|
71
|
-
/**
|
|
72
|
-
* @description 自动获取焦点,在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 ( 默认 false )
|
|
73
|
-
* */
|
|
74
|
-
focus?: boolean
|
|
75
|
-
/**
|
|
76
|
-
* @description 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 ( 默认 false )
|
|
77
|
-
* */
|
|
78
|
-
autoBlur?: boolean
|
|
79
|
-
/**
|
|
80
|
-
* @description 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 ( 默认 false )
|
|
81
|
-
* */
|
|
82
|
-
disableDefaultPadding?: boolean
|
|
83
|
-
/**
|
|
84
|
-
* @description 指定focus时光标的位置( 默认 140 )
|
|
85
|
-
* */
|
|
86
|
-
cursor?: number
|
|
87
|
-
/**
|
|
88
|
-
* @description 输入框聚焦时底部与键盘的距离 ( 默认 30 )
|
|
89
|
-
* */
|
|
90
|
-
cursorSpacing?: number
|
|
91
|
-
/**
|
|
92
|
-
* @description 光标起始位置,自动聚集时有效,需与selection-end搭配使用 ( 默认 -1 )
|
|
93
|
-
* */
|
|
94
|
-
selectionStart?: number
|
|
95
|
-
/**
|
|
96
|
-
* @description 光标结束位置,自动聚集时有效,需与selection-start搭配使用 ( 默认 -1 )
|
|
97
|
-
* */
|
|
98
|
-
selectionEnd?: number
|
|
99
|
-
/**
|
|
100
|
-
* @description 键盘弹起时,是否自动上推页面 ( 默认 true )
|
|
101
|
-
* */
|
|
102
|
-
adjustPosition?: boolean
|
|
103
|
-
/**
|
|
104
|
-
* @description 输入框内容对齐方式( 默认 'left' )
|
|
105
|
-
* */
|
|
106
|
-
inputAlign?: HyApp.RowCenterType
|
|
107
|
-
/**
|
|
108
|
-
* @description 输入框字体的大小 ( 默认 '15px' )
|
|
109
|
-
* */
|
|
110
|
-
fontSize?: string | number
|
|
111
|
-
/**
|
|
112
|
-
* @description 输入框字体颜色 ( 默认 '#303133' )
|
|
113
|
-
* */
|
|
114
|
-
color?: string
|
|
115
|
-
/**
|
|
116
|
-
* @description 输入框前置图标
|
|
117
|
-
* */
|
|
118
|
-
prefixIcon?: Partial<HyIconProps>
|
|
119
|
-
/**
|
|
120
|
-
* @description 输入框后置图标
|
|
121
|
-
* */
|
|
122
|
-
suffixIcon?: Partial<HyIconProps>
|
|
123
|
-
/**
|
|
124
|
-
* @description 边框类型,surround-四周边框,bottom-底部边框,none-无边框 ( 默认 'surround' )
|
|
125
|
-
* */
|
|
126
|
-
border?: HyApp.BorderType
|
|
127
|
-
/**
|
|
128
|
-
* @description 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 ( 默认 false )
|
|
129
|
-
* */
|
|
130
|
-
readonly?: boolean
|
|
131
|
-
/**
|
|
132
|
-
* @description 输入框形状,circle-圆形,square-方形 ( 默认 'square' )
|
|
133
|
-
* */
|
|
134
|
-
shape?: HyApp.ShapeType
|
|
135
|
-
/**
|
|
136
|
-
* @description 内容式化函数
|
|
137
|
-
* */
|
|
138
|
-
formatter?: Function | null
|
|
139
|
-
/**
|
|
140
|
-
* @description 定义需要用到的外部样式
|
|
141
|
-
* */
|
|
142
|
-
customStyle?: CSSProperties
|
|
143
|
-
/**
|
|
144
|
-
* @description 值变化事件
|
|
145
|
-
* */
|
|
146
|
-
onChange?: Function
|
|
147
|
-
/**
|
|
148
|
-
* @description 失去焦点事件
|
|
149
|
-
* */
|
|
150
|
-
onBlur?: Function
|
|
151
|
-
/**
|
|
152
|
-
* @description 是否忽略组件内对文本合成系统事件的处理。
|
|
153
|
-
* */
|
|
154
|
-
ignoreCompositionEvent?: boolean
|
|
155
|
-
}
|
|
156
|
-
|
|
157
8
|
export interface IInputEmits {
|
|
158
9
|
/** 输入框失去焦点时触发 */
|
|
159
10
|
(e: 'blur', event: InputOnBlurEvent, value: string | number): void
|