feat(Field): highlight word num when reaching maxlength

This commit is contained in:
陈嘉涵
2020-02-05 15:58:51 +08:00
parent eb7abea49c
commit 61093ef00f
5 changed files with 32 additions and 1 deletions
+5 -1
View File
@@ -303,9 +303,13 @@ export default createComponent({
genWordLimit() {
if (this.showWordLimit && this.maxlength) {
const count = this.value.length;
const full = count >= this.maxlength;
return (
<div class={bem('word-limit')}>
{this.value.length}/{this.maxlength}
<span class={bem('word-num', { full })}>{count}</span>/
{this.maxlength}
</div>
);
}