提交 edbabb2c 编写于 作者: D DCloud_LXH

fix: input placeholder displya question/160726

上级 8d57d78a
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
class="uni-input-wrapper" class="uni-input-wrapper"
> >
<div <div
v-show="!(composing || valueSync.length || cachedValue.length || cachedValue === '-')" v-show="showPlaceholder"
ref="placeholder" ref="placeholder"
:style="placeholderStyle" :style="placeholderStyle"
:class="placeholderClass" :class="placeholderClass"
...@@ -156,6 +156,13 @@ export default { ...@@ -156,6 +156,13 @@ export default {
? kebabCaseIndex ? kebabCaseIndex
: 0 : 0
return AUTOCOMPLETES[index] return AUTOCOMPLETES[index]
},
showPlaceholder () {
const dotIndex = this.type === 'digit' ? this.cachedValue.indexOf('.') : -1
return !(
this.composing || this.valueSync.length || this.cachedValue === '-' ||
(dotIndex !== -1 && dotIndex === this.cachedValue.length - 1)
)
} }
}, },
watch: { watch: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册