Skip to content

Commit 56aa27c

Browse files
authored
fix(input): [input] fix input remembers the input history and does not record blank characters (#2372)
1 parent 369efa5 commit 56aa27c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<template>
22
<div class="demo-input">
3-
<tiny-input v-model="input" counter></tiny-input>
3+
<tiny-input type="textarea" v-model="input" display-only popup-more></tiny-input>
44
</div>
55
</template>
66

77
<script setup>
88
import { ref } from 'vue'
99
import { Input as TinyInput } from '@opentiny/vue'
1010
11-
const input = ref('')
11+
const input = ref(
12+
'表单文本域开启只读模式,文本内容超过5行自动隐藏。表单文本域开启只读模式,文本内容超过5行自动隐藏。表单文本域开启只读模式,文本内容超过5行自动隐藏。表单文本域开启只读模式,文本内容超过5行自动隐藏。表单文本域开启只读模式,文本内容超过5行自动隐藏'
13+
)
1214
</script>
1315

1416
<style scoped>
15-
.demo-input .tiny-input {
16-
width: 250px;
17+
.demo-input .tiny-textarea {
18+
width: 260px;
1719
}
1820
</style>

packages/renderless/src/tall-storage/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ const setLocalStorageage = (name, value, memorySpace = 5) => {
129129
}
130130

131131
export const addMemory = (props) => (value) => {
132-
if (props.name && value) {
132+
// input记忆历史输入不添加空白字符
133+
if (props.name && value?.trim()) {
133134
setLocalStorageage(props.name, value, props.memorySpace)
134135
}
135136
}

0 commit comments

Comments
 (0)