فهرست منبع

修复 cl-select-date 组件在范围选择模式下首次渲染时内容未显示的问题

icssoa 6 ماه پیش
والد
کامیت
bc76c6e591
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      uni_modules/cool-ui/components/cl-select-date/cl-select-date.uvue

+ 3 - 2
uni_modules/cool-ui/components/cl-select-date/cl-select-date.uvue

@@ -644,11 +644,10 @@ async function onChange(data: number[]) {
 
 // 设置value
 function setValue(val: string) {
-	text.value = "";
-
 	// 如果值为空,使用当前时间
 	if (isNull(val) || isEmpty(val)) {
 		value.value = checkDate(dayUts().toArray());
+		text.value = "";
 	} else {
 		// 否则解析为数组
 		value.value = checkDate(dayUts(val).toArray());
@@ -660,8 +659,10 @@ function setValue(val: string) {
 function setValues(val: string[]) {
 	if (isEmpty(val)) {
 		values.value = ["", ""];
+		text.value = "";
 	} else {
 		values.value = val;
+		updateText();
 	}
 }