From ec90cbd7680a6f927cb1cea43f33ab7df6d0864c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 11 十一月 2025 09:23:22 +0800
Subject: [PATCH] -
---
src/uni_modules/uview-plus/components/u-waterfall/u-waterfall.vue | 45 +++++++++++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/src/uni_modules/uview-plus/components/u-waterfall/u-waterfall.vue b/src/uni_modules/uview-plus/components/u-waterfall/u-waterfall.vue
index 69eb932..f978c05 100644
--- a/src/uni_modules/uview-plus/components/u-waterfall/u-waterfall.vue
+++ b/src/uni_modules/uview-plus/components/u-waterfall/u-waterfall.vue
@@ -67,11 +67,16 @@
},
watch: {
copyFlowList(nVal, oVal) {
- // 鍙栧樊鍊硷紝鍗宠繖涓�娆℃暟缁勫彉鍖栨柊澧炵殑閮ㄥ垎
- let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0;
- // 鎷兼帴涓婂師鏈夋暟鎹�
- this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)));
- this.splitData();
+ if (!nVal || nVal.length == 0) {
+ this.clear(false);
+ // console.log('clear');
+ } else {
+ // 鍙栧樊鍊硷紝鍗宠繖涓�娆℃暟缁勫彉鍖栨柊澧炵殑閮ㄥ垎
+ let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0;
+ // 鎷兼帴涓婂師鏈夋暟鎹�
+ this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)));
+ this.splitData();
+ }
}
},
mounted() {
@@ -81,11 +86,17 @@
computed: {
// 鐮村潖flowList鍙橀噺鐨勫紩鐢紝鍚﹀垯watch鐨勭粨鏋滄柊鏃у�兼槸涓�鏍风殑
copyFlowList() {
+ // #ifdef VUE3
+ if (!this.modelValue || this.modelValue.length == 0) {
+ this.clear(false);
+ // console.log('clear');
+ return [];
+ } else {
+ return this.cloneData(this.modelValue);
+ }
+ // #endif
// #ifdef VUE2
return this.cloneData(this.value);
- // #endif
- // #ifdef VUE3
- return this.cloneData(this.modelValue);
// #endif
}
},
@@ -127,16 +138,18 @@
return JSON.parse(JSON.stringify(data));
},
// 娓呯┖鏁版嵁鍒楄〃
- clear() {
+ clear(bak = true) {
this.leftList = [];
this.rightList = [];
// 鍚屾椂娓呴櫎鐖剁粍浠跺垪琛ㄤ腑鐨勬暟鎹�
- // #ifdef VUE2
- this.$emit('input', []);
- // #endif
- // #ifdef VUE3
- this.$emit('update:modelValue', []);
- // #endif
+ if (bak) {
+ // #ifdef VUE2
+ this.$emit('input', []);
+ // #endif
+ // #ifdef VUE3
+ this.$emit('update:modelValue', []);
+ // #endif
+ }
this.tempList = [];
},
// 娓呴櫎鏌愪竴鏉℃寚瀹氱殑鏁版嵁锛屾牴鎹甶d瀹炵幇
@@ -230,4 +243,4 @@
max-width: 100%;
/* #endif */
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.1