提交 b2af305e 编写于 作者: D DCloud_LXH

feat: input inputmode

上级 b90a3403
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
class="uni-input-wrapper" class="uni-input-wrapper"
> >
<div <div
v-show="!(composing || valueSync.length || cachedValue === '-')" v-show="!(composing || valueSync.length || cachedValue.length || cachedValue === '-')"
ref="placeholder" ref="placeholder"
:style="placeholderStyle" :style="placeholderStyle"
:class="placeholderClass" :class="placeholderClass"
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
:pattern="type === 'number' ? '[0-9]*' : null" :pattern="type === 'number' ? '[0-9]*' : null"
class="uni-input-input" class="uni-input-input"
:autocomplete="autocomplete" :autocomplete="autocomplete"
:inputmode="inputmode"
@change.stop @change.stop
@focus="_onFocus" @focus="_onFocus"
@blur="_onBlur" @blur="_onBlur"
...@@ -147,6 +148,14 @@ export default { ...@@ -147,6 +148,14 @@ export default {
? kebabCaseIndex ? kebabCaseIndex
: 0 : 0
return AUTOCOMPLETES[index] return AUTOCOMPLETES[index]
},
inputmode () {
switch (this.type) {
case 'digit':
return 'decimal'
default:
return undefined
}
} }
}, },
watch: { watch: {
...@@ -257,7 +266,7 @@ export default { ...@@ -257,7 +266,7 @@ export default {
// 输入小数点时 // 输入小数点时
this.cachedValue += '.' this.cachedValue += '.'
this.__clearCachedValue = () => { this.__clearCachedValue = () => {
this.cachedValue = $event.target.value = this.cachedValue.slice(0, -1) this.cachedValue = this.valueSync = $event.target.value = this.cachedValue.slice(0, -1)
} }
$event.target.addEventListener('blur', this.__clearCachedValue) $event.target.addEventListener('blur', this.__clearCachedValue)
return false return false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册