hy-app 0.2.14 → 0.2.15
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/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/hy-button.vue +22 -40
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +3 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/compiler.ts +0 -108
- package/component-helper.ts +0 -179
- package/components.json +0 -3287
- package/docgen.config.js +0 -13
- package/web-types.config.js +0 -7
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
|
-
class="hy-textarea"
|
|
4
|
-
:class="textareaClass"
|
|
3
|
+
:class="['hy-textarea', customClass, textareaClass]"
|
|
5
4
|
:style="[textareaStyle, borderStyle(isFocus)]"
|
|
6
5
|
>
|
|
7
6
|
<textarea
|
|
@@ -39,164 +38,259 @@
|
|
|
39
38
|
'background-color': disabled ? 'transparent' : '',
|
|
40
39
|
}"
|
|
41
40
|
v-if="count"
|
|
42
|
-
>{{ innerValue.length }}/{{ maxlength }}</text
|
|
43
41
|
>
|
|
42
|
+
{{ innerValue.length }}/{{ maxlength }}
|
|
43
|
+
</text>
|
|
44
44
|
<!-- #endif -->
|
|
45
45
|
</view>
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script lang="ts">
|
|
49
|
+
/**
|
|
50
|
+
* 用于输入多行文本信息,聊天输入框等。
|
|
51
|
+
* @displayName hy-textarea
|
|
52
|
+
*/
|
|
53
|
+
defineOptions({})
|
|
49
54
|
export default {
|
|
50
|
-
name:
|
|
55
|
+
name: 'hy-textarea',
|
|
51
56
|
options: {
|
|
52
57
|
addGlobalClass: true,
|
|
53
58
|
virtualHost: true,
|
|
54
|
-
styleIsolation:
|
|
59
|
+
styleIsolation: 'shared',
|
|
55
60
|
},
|
|
56
|
-
}
|
|
61
|
+
}
|
|
57
62
|
</script>
|
|
58
63
|
|
|
59
64
|
<script setup lang="ts">
|
|
60
|
-
import {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
toRefs,
|
|
65
|
-
watch,
|
|
66
|
-
nextTick,
|
|
67
|
-
} from "vue";
|
|
68
|
-
import type IProps from "./typing";
|
|
69
|
-
import defaultProps from "./props";
|
|
70
|
-
import { addUnit } from "../../utils";
|
|
71
|
-
import { ColorConfig } from "@/package";
|
|
65
|
+
import { computed, ref, toRefs, watch, nextTick } from 'vue'
|
|
66
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
67
|
+
import type { ITextareaEmits } from './typing'
|
|
68
|
+
import { addUnit } from '../../utils'
|
|
72
69
|
|
|
73
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
71
|
+
const props = defineProps({
|
|
72
|
+
/** 输入框的内容 */
|
|
73
|
+
modelValue: String,
|
|
74
|
+
/** 输入框为空时占位符 */
|
|
75
|
+
placeholder: String,
|
|
76
|
+
/** 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ */
|
|
77
|
+
placeholderClass: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'textarea-placeholder',
|
|
80
|
+
},
|
|
81
|
+
/** 指定placeholder的样式,对象形式 */
|
|
82
|
+
placeholderStyle: Object as PropType<CSSProperties>,
|
|
83
|
+
/** 输入框高度 */
|
|
84
|
+
height: {
|
|
85
|
+
type: [String, Number],
|
|
86
|
+
default: 70,
|
|
87
|
+
},
|
|
88
|
+
/** 设置键盘右下角按钮的文字,仅微信小程序,App-vue和H5有效 */
|
|
89
|
+
confirmType: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: 'done',
|
|
92
|
+
},
|
|
93
|
+
/** 是否禁用 */
|
|
94
|
+
disabled: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
/** 是否显示统计字数 */
|
|
99
|
+
count: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
/** 是否自动获取焦点,nvue不支持,H5取决于浏览器的实现 */
|
|
104
|
+
focus: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
/** 是否自动增加高度 */
|
|
109
|
+
autoHeight: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
/** 如果textarea是在一个position:fixed的区域,需要显示指定属性fixed为true */
|
|
114
|
+
fixed: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false,
|
|
117
|
+
},
|
|
118
|
+
/** 指定光标与键盘的距离 */
|
|
119
|
+
cursorSpacing: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: 0,
|
|
122
|
+
},
|
|
123
|
+
/** 指定focus时的光标位置 */
|
|
124
|
+
cursor: [String, Number],
|
|
125
|
+
/** 是否显示键盘上方带有”完成“按钮那一栏 */
|
|
126
|
+
showConfirmBar: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true,
|
|
129
|
+
},
|
|
130
|
+
/** 光标起始位置,自动聚焦时有效,需与selection-end搭配使用, */
|
|
131
|
+
selectionStart: {
|
|
132
|
+
type: Number,
|
|
133
|
+
default: -1,
|
|
134
|
+
},
|
|
135
|
+
/** 光标结束位置,自动聚焦时有效,需与selection-start搭配使用 */
|
|
136
|
+
selectionEnd: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: -1,
|
|
139
|
+
},
|
|
140
|
+
/** 键盘弹起时,是否自动上推页面 */
|
|
141
|
+
adjustPosition: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: true,
|
|
144
|
+
},
|
|
145
|
+
/** 是否去掉 iOS 下的默认内边距,只微信小程序有效 */
|
|
146
|
+
disableDefaultPadding: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false,
|
|
149
|
+
},
|
|
150
|
+
/** focus时,点击页面的时候不收起键盘,只微信小程序有效 */
|
|
151
|
+
holdKeyboard: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false,
|
|
154
|
+
},
|
|
155
|
+
/** 最大输入长度,设置为 -1 的时候不限制最大长度 */
|
|
156
|
+
maxlength: {
|
|
157
|
+
type: Number,
|
|
158
|
+
default: 140,
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* 边框类型
|
|
162
|
+
* @values surround,none,bottom
|
|
163
|
+
* */
|
|
164
|
+
border: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: 'surround',
|
|
167
|
+
},
|
|
168
|
+
/** 内容式化函数 */
|
|
169
|
+
formatter: Function,
|
|
170
|
+
/** 定义需要用到的外部样式 */
|
|
171
|
+
customStyle: {
|
|
172
|
+
type: Object as PropType<CSSProperties>,
|
|
173
|
+
},
|
|
174
|
+
/** 自定义外部类名 */
|
|
175
|
+
customClass: String,
|
|
176
|
+
})
|
|
177
|
+
const { modelValue, customStyle, border, disabled, formatter } = toRefs(props)
|
|
178
|
+
const emit = defineEmits<ITextareaEmits>()
|
|
84
179
|
|
|
85
180
|
// 输入框的值
|
|
86
|
-
const innerValue = ref<string>(
|
|
181
|
+
const innerValue = ref<string>('')
|
|
87
182
|
// 是否处于获得焦点状态
|
|
88
|
-
const focused = ref<boolean>(false)
|
|
183
|
+
const focused = ref<boolean>(false)
|
|
89
184
|
// value是否第一次变化,在watch中,由于加入immediate属性,会在第一次触发,此时不应该认为value发生了变化
|
|
90
|
-
const firstChange = ref<boolean>(true)
|
|
185
|
+
const firstChange = ref<boolean>(true)
|
|
91
186
|
// value绑定值的变化是由内部还是外部引起的
|
|
92
|
-
const changeFromInner = ref<boolean>(false)
|
|
187
|
+
const changeFromInner = ref<boolean>(false)
|
|
93
188
|
// 是否获取焦点
|
|
94
|
-
const isFocus = ref<boolean>(false)
|
|
189
|
+
const isFocus = ref<boolean>(false)
|
|
95
190
|
// 过滤处理方法
|
|
96
|
-
let innerFormatter = (value: string) => value
|
|
191
|
+
let innerFormatter = (value: string) => value
|
|
97
192
|
|
|
98
193
|
watch(
|
|
99
194
|
() => modelValue.value,
|
|
100
195
|
(newVal) => {
|
|
101
|
-
innerValue.value = newVal
|
|
196
|
+
innerValue.value = newVal
|
|
102
197
|
/* #ifdef H5 */
|
|
103
198
|
// 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
|
|
104
199
|
if (firstChange.value === false && changeFromInner.value === false) {
|
|
105
|
-
valueChange()
|
|
200
|
+
valueChange()
|
|
106
201
|
}
|
|
107
202
|
/* #endif */
|
|
108
|
-
firstChange.value = false
|
|
203
|
+
firstChange.value = false
|
|
109
204
|
// 重置changeFromInner的值为false,标识下一次引起默认为外部引起的
|
|
110
|
-
changeFromInner.value = false
|
|
205
|
+
changeFromInner.value = false
|
|
111
206
|
},
|
|
112
207
|
{ immediate: true },
|
|
113
|
-
)
|
|
208
|
+
)
|
|
114
209
|
|
|
115
210
|
// 组件的类名
|
|
116
211
|
const textareaClass = computed(() => {
|
|
117
|
-
let classes: string[] = []
|
|
118
|
-
border.value ===
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
212
|
+
let classes: string[] = []
|
|
213
|
+
border.value === 'surround' && (classes = classes.concat(['hy-border', 'hy-textarea--radius']))
|
|
214
|
+
border.value === 'bottom' &&
|
|
215
|
+
(classes = classes.concat(['hy-border__bottom', 'hy-textarea--no-radius']))
|
|
216
|
+
disabled.value && classes.push('hy-textarea--disabled')
|
|
217
|
+
return classes.join(' ')
|
|
218
|
+
})
|
|
125
219
|
// 组件的样式
|
|
126
220
|
const textareaStyle = computed(() => {
|
|
127
|
-
const style: CSSProperties = {}
|
|
221
|
+
const style: CSSProperties = {}
|
|
128
222
|
|
|
129
|
-
return Object.assign(style, customStyle.value)
|
|
130
|
-
})
|
|
223
|
+
return Object.assign(style, customStyle.value)
|
|
224
|
+
})
|
|
131
225
|
/**
|
|
132
226
|
* @description 边框颜色
|
|
133
227
|
* */
|
|
134
228
|
const borderStyle = computed(() => {
|
|
135
229
|
return (isFocus: boolean) => {
|
|
136
|
-
let style: CSSProperties = {}
|
|
230
|
+
let style: CSSProperties = {}
|
|
137
231
|
if (isFocus) {
|
|
138
232
|
switch (border.value) {
|
|
139
|
-
case
|
|
140
|
-
style = { border: `1px solid var(--hy-theme-color, #3c9cff)` }
|
|
141
|
-
break
|
|
142
|
-
case
|
|
143
|
-
style = { borderBottom: `1px solid var(--hy-theme-color, #3c9cff)` }
|
|
144
|
-
break
|
|
233
|
+
case 'surround':
|
|
234
|
+
style = { border: `1px solid var(--hy-theme-color, #3c9cff)` }
|
|
235
|
+
break
|
|
236
|
+
case 'bottom':
|
|
237
|
+
style = { borderBottom: `1px solid var(--hy-theme-color, #3c9cff)` }
|
|
238
|
+
break
|
|
145
239
|
default:
|
|
146
|
-
break
|
|
240
|
+
break
|
|
147
241
|
}
|
|
148
242
|
}
|
|
149
|
-
return style
|
|
150
|
-
}
|
|
151
|
-
})
|
|
243
|
+
return style
|
|
244
|
+
}
|
|
245
|
+
})
|
|
152
246
|
|
|
153
247
|
const onFocus = (e: FocusEvent) => {
|
|
154
|
-
isFocus.value = true
|
|
155
|
-
emit(
|
|
156
|
-
}
|
|
248
|
+
isFocus.value = true
|
|
249
|
+
emit('focus', e)
|
|
250
|
+
}
|
|
157
251
|
const onBlur = (e: FocusEvent) => {
|
|
158
|
-
isFocus.value = false
|
|
159
|
-
emit(
|
|
252
|
+
isFocus.value = false
|
|
253
|
+
emit('blur', e)
|
|
160
254
|
// 尝试调用u-form的验证方法
|
|
161
255
|
// formValidate(this, "blur");
|
|
162
|
-
}
|
|
256
|
+
}
|
|
163
257
|
const onLinechange = (e: Event) => {
|
|
164
|
-
emit(
|
|
165
|
-
}
|
|
258
|
+
emit('linechange', e)
|
|
259
|
+
}
|
|
166
260
|
const onInput = (e: Event) => {
|
|
167
|
-
let { value } = e?.detail
|
|
261
|
+
let { value } = e?.detail
|
|
168
262
|
// 格式化过滤方法
|
|
169
|
-
const format = formatter.value || innerFormatter
|
|
170
|
-
const formatValue = format(value)
|
|
263
|
+
const format = formatter.value || innerFormatter
|
|
264
|
+
const formatValue = format(value)
|
|
171
265
|
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
172
|
-
innerValue.value = value
|
|
266
|
+
innerValue.value = value
|
|
173
267
|
nextTick(() => {
|
|
174
|
-
innerValue.value = formatValue
|
|
175
|
-
valueChange()
|
|
176
|
-
})
|
|
177
|
-
}
|
|
268
|
+
innerValue.value = formatValue
|
|
269
|
+
valueChange()
|
|
270
|
+
})
|
|
271
|
+
}
|
|
178
272
|
/**
|
|
179
273
|
* @description 内容发生变化,进行处理
|
|
180
274
|
* */
|
|
181
275
|
const valueChange = () => {
|
|
182
|
-
const value = innerValue.value
|
|
276
|
+
const value = innerValue.value
|
|
183
277
|
nextTick(() => {
|
|
184
|
-
emit(
|
|
278
|
+
emit('update:modelValue', value)
|
|
185
279
|
// 标识value值的变化是由内部引起的
|
|
186
|
-
changeFromInner.value = true
|
|
187
|
-
emit(
|
|
280
|
+
changeFromInner.value = true
|
|
281
|
+
emit('change', value)
|
|
188
282
|
// 尝试调用u-form的验证方法
|
|
189
283
|
// formValidate(this, "change");
|
|
190
|
-
})
|
|
191
|
-
}
|
|
284
|
+
})
|
|
285
|
+
}
|
|
192
286
|
const onConfirm = (e: Event) => {
|
|
193
|
-
emit(
|
|
194
|
-
}
|
|
287
|
+
emit('confirm', e)
|
|
288
|
+
}
|
|
195
289
|
const onKeyboardheightchange = (e: Event) => {
|
|
196
|
-
emit(
|
|
197
|
-
}
|
|
290
|
+
emit('keyboardheightchange', e)
|
|
291
|
+
}
|
|
198
292
|
</script>
|
|
199
293
|
|
|
200
294
|
<style lang="scss" scoped>
|
|
201
|
-
@import
|
|
295
|
+
@import './index.scss';
|
|
202
296
|
</style>
|
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
3
|
export default interface HyTextareaProps {
|
|
4
|
-
modelValue: string
|
|
5
|
-
placeholder?: string | null
|
|
6
|
-
placeholderClass?: string
|
|
7
|
-
placeholderStyle?: CSSProperties
|
|
8
|
-
height?: number
|
|
9
|
-
confirmType?:
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
count?: boolean
|
|
12
|
-
focus?: boolean
|
|
13
|
-
autoHeight?: boolean
|
|
14
|
-
fixed?: boolean
|
|
15
|
-
cursorSpacing?: number
|
|
16
|
-
cursor?: string
|
|
17
|
-
showConfirmBar?: boolean
|
|
18
|
-
selectionStart?: number
|
|
19
|
-
selectionEnd?: number
|
|
20
|
-
adjustPosition?: boolean
|
|
21
|
-
disableDefaultPadding?: boolean
|
|
22
|
-
holdKeyboard?: boolean
|
|
23
|
-
maxlength?: number
|
|
24
|
-
border?: HyApp.BorderType
|
|
25
|
-
formatter?: ((value: string) => string) | null
|
|
26
|
-
customStyle?: CSSProperties
|
|
4
|
+
modelValue: string
|
|
5
|
+
placeholder?: string | null
|
|
6
|
+
placeholderClass?: string
|
|
7
|
+
placeholderStyle?: CSSProperties
|
|
8
|
+
height?: number
|
|
9
|
+
confirmType?: 'done' | 'send' | 'search' | 'next' | 'go'
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
count?: boolean
|
|
12
|
+
focus?: boolean
|
|
13
|
+
autoHeight?: boolean
|
|
14
|
+
fixed?: boolean
|
|
15
|
+
cursorSpacing?: number
|
|
16
|
+
cursor?: string
|
|
17
|
+
showConfirmBar?: boolean
|
|
18
|
+
selectionStart?: number
|
|
19
|
+
selectionEnd?: number
|
|
20
|
+
adjustPosition?: boolean
|
|
21
|
+
disableDefaultPadding?: boolean
|
|
22
|
+
holdKeyboard?: boolean
|
|
23
|
+
maxlength?: number
|
|
24
|
+
border?: HyApp.BorderType
|
|
25
|
+
formatter?: ((value: string) => string) | null
|
|
26
|
+
customStyle?: CSSProperties
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ITextareaEmits {
|
|
30
|
+
/** 输入框失去焦点时触发 */
|
|
31
|
+
(e: 'blur', event: any): void
|
|
32
|
+
/** 输入框聚焦时触发 */
|
|
33
|
+
(e: 'focus', event: any): void
|
|
34
|
+
/** 当键盘输入时,触发 input 事件 */
|
|
35
|
+
(e: 'change', value: string): void
|
|
36
|
+
/** 点击完成时, 触发 confirm 事件 */
|
|
37
|
+
(e: 'confirm', event: any): void
|
|
38
|
+
/** 输入框行数变化时调用 */
|
|
39
|
+
(e: 'linechange'): void
|
|
40
|
+
/** 当键盘输入时,触发 input 事件 */
|
|
41
|
+
(e: 'update:modelValue', value: string): void
|
|
42
|
+
/** 键盘高度发生变化的时候触发此事件 */
|
|
43
|
+
(e: 'keyboardheightchange', event: any): void
|
|
27
44
|
}
|