Skip to content

Commit 37350ee

Browse files
author
xuqingkai
committed
fix: 🐛 修复DatetimePicker区间模式未选值时显示占位符错误的问题
1 parent 21839e0 commit 37350ee

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,20 @@
1919
<view class="wd-picker__body">
2020
<view class="wd-picker__value-wraper">
2121
<view :class="`wd-picker__value ${customValueClass}`">
22-
<view v-if="region">
23-
<text :class="(showValue as string[])[0] ? '' : 'wd-picker__placeholder'">
24-
{{ (showValue as string[])[0] ? (showValue as string[])[0] : placeholder }}
25-
</text>
26-
{{ translate('to') }}
27-
<text :class="(showValue as string[])[1] ? '' : 'wd-picker__placeholder'">
28-
{{ (showValue as string[])[1] ? (showValue as string[])[1] : placeholder }}
29-
</text>
30-
</view>
22+
<template v-if="region">
23+
<view v-if="isArray(showValue) && showValue.length === 2 && showValue[0] !== '' && showValue[1] !== ''">
24+
<text :class="showValue[0] ? '' : 'wd-picker__placeholder'">
25+
{{ showValue[0] ? showValue[0] : placeholder }}
26+
</text>
27+
{{ translate('to') }}
28+
<text :class="showValue[1] ? '' : 'wd-picker__placeholder'">
29+
{{ showValue[1] ? showValue[1] : placeholder }}
30+
</text>
31+
</view>
32+
<view v-else class="wd-picker__placeholder">
33+
{{ placeholder || translate('placeholder') }}
34+
</view>
35+
</template>
3136
<view v-else :class="showValue ? '' : 'wd-picker__placeholder'">
3237
{{ showValue ? showValue : placeholder || translate('placeholder') }}
3338
</view>

0 commit comments

Comments
 (0)