Skip to content

Commit bb3d329

Browse files
authored
fix: 🐛 修复Textarea的placeholder无法设置空字符串问题 (#472)
* fix: 🐛 修复Textarea的placeholder无法设置空字符串问题 ✅ Closes: #471 * fix: 🐛 修复支付宝小程序无法使用空值运算符问题
1 parent b0e4d23 commit bb3d329

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
:class="`wd-textarea__inner ${customTextareaClass}`"
1818
v-model="inputValue"
1919
:show-count="false"
20-
:placeholder="placeholder || translate('placeholder')"
20+
:placeholder="placeholderValue"
2121
:disabled="disabled"
2222
:maxlength="maxlength"
2323
:focus="isFocus"
@@ -72,7 +72,7 @@ export default {
7272

7373
<script lang="ts" setup>
7474
import { computed, onBeforeMount, ref, watch } from 'vue'
75-
import { objToStyle, requestAnimationFrame } from '../common/util'
75+
import { objToStyle, requestAnimationFrame, isDef } from '../common/util'
7676
import { useCell } from '../composables/useCell'
7777
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
7878
import { useParent } from '../composables/useParent'
@@ -96,6 +96,10 @@ const emit = defineEmits([
9696
'click'
9797
])
9898
99+
const placeholderValue = computed(() => {
100+
return isDef(props.placeholder) ? props.placeholder : translate('placeholder')
101+
})
102+
99103
const showClear = ref<boolean>(false)
100104
const showWordCount = ref<boolean>(false)
101105
const clearing = ref<boolean>(false)

0 commit comments

Comments
 (0)