From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/uview-plus/components/u-cascader/u-cascader.vue | 72 ++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/node_modules/uview-plus/components/u-cascader/u-cascader.vue b/node_modules/uview-plus/components/u-cascader/u-cascader.vue
index f1a4fa9..a723f2a 100644
--- a/node_modules/uview-plus/components/u-cascader/u-cascader.vue
+++ b/node_modules/uview-plus/components/u-cascader/u-cascader.vue
@@ -1,12 +1,14 @@
<template>
<up-popup :show="popupShow" mode="bottom" :popup="false"
- :mask="true" :closeable="true" :safe-area-inset-bottom="true"
+ :mask="true" :closeable="closeable" :safe-area-inset-bottom="true"
close-icon-color="#ffffff" :z-index="uZIndex"
:maskCloseAble="maskCloseAble" @close="close">
- <view class="up-p-t-30 up-p-l-20 up-m-b-10" v-if="headerDirection =='column'">
+ <view class="up-p-t-30 up-p-l-20 up-m-b-10" v-if="headerDirection ==='column'">
<up-steps v-if="popupShow" dot direction="column" v-model:current="tabsIndex">
- <up-steps-item v-for="(item, index) in genTabsList"
- @click="tabsIndex = index" :title="item.name"></up-steps-item>
+ <view v-for="(item, index) in genTabsList" @click="toFatherIndex(index)">
+ <up-steps-item
+ :title="item.name"/>
+ </view>
</up-steps>
</view>
<view class="up-p-t-20 up-m-b-10" v-else>
@@ -61,6 +63,7 @@
* @property {String} labelKey 鎸囧畾閫夐」鏍囩涓洪�夐」瀵硅薄涓殑鍝釜灞炴�у��
* @property {String} childrenKey 鎸囧畾閫夐」鐨勫瓙閫夐」涓洪�夐」瀵硅薄涓殑鍝釜灞炴�у��
* @property {Boolean} autoClose 鏄惁鍦ㄩ�夋嫨鏈�鍚庝竴绾ф椂鑷姩鍏抽棴骞惰Е鍙慶onfirm锛堥粯璁alse锛�
+ * @property {Boolean} closeable 鏄惁鏄剧ず鍏抽棴鍥炬爣锛堥粯璁rue锛�
*/
import { t } from '../../libs/i18n'
export default {
@@ -124,6 +127,11 @@
optionsCols: {
type: [Number],
default: 2
+ },
+ // 鏄惁鏄剧ず鍏抽棴鍥炬爣
+ closeable: {
+ type: Boolean,
+ default: true
}
},
data() {
@@ -142,6 +150,7 @@
data: {
handler() {
this.initLevelList();
+ this.setDefaultValue();
},
immediate: true
},
@@ -150,7 +159,8 @@
},
modelValue: {
handler() {
- this.init();
+ // 鍒濆鍖栭�変腑鍊�
+ this.setDefaultValue();
},
immediate: true
}
@@ -163,7 +173,7 @@
let tabsList = [{
name: "璇烽�夋嫨"
}];
-
+
// 鏍规嵁閫変腑鐨勫�煎姩鎬佺敓鎴恡abs
for (let i = 0; i < this.selectedValueIndexs.length; i++) {
if (this.selectedValueIndexs[i] !== undefined && this.levelList[i]) {
@@ -173,8 +183,8 @@
name: selectedItem[this.labelKey]
};
// 濡傛灉杩樻湁涓嬩竴绾э紝鍒欐坊鍔�"璇烽�夋嫨"
- if (i === this.selectedValueIndexs.length - 1 &&
- selectedItem[this.childrenKey] &&
+ if (i === this.selectedValueIndexs.length - 1 &&
+ selectedItem[this.childrenKey] &&
selectedItem[this.childrenKey].length > 0) {
tabsList.push({
name: "璇烽�夋嫨"
@@ -183,7 +193,7 @@
}
}
}
-
+
return tabsList;
},
uZIndex() {
@@ -192,15 +202,9 @@
}
},
// 鏂板confirm浜嬩欢
- emits: ['update:modelValue', 'change', 'confirm'],
+ emits: ['update:modelValue', 'update:show', 'change', 'confirm', 'cancel'],
methods: {
t,
- init() {
- // 鍒濆鍖栭�変腑鍊�
- if (this.modelValue && this.modelValue.length > 0) {
- this.setDefaultValue();
- }
- },
initLevelList() {
// 鍒濆鍖栫涓�绾ф暟鎹�
if (this.data && this.data.length > 0) {
@@ -209,15 +213,21 @@
}
},
setDefaultValue() {
+ // 妫�鏌ata鏄惁涓虹┖
+ if (!this.data || this.data.length == 0) return;
+ // 妫�鏌odelValue鏄惁涓虹┖
+ if (!this.modelValue || this.modelValue.length == 0) return;
// 鏍规嵁榛樿鍊艰缃�変腑椤�
// 鏍规嵁modelValue鑾峰彇indexs缁檚electedValueIndexs
this.selectedValueIndexs = [];
+ this.levelList = []; // 璁剧疆灞傜骇鏁版嵁涓虹┖
let currentLevelData = this.data;
-
+
for (let i = 0; i < this.modelValue.length; i++) {
const value = this.modelValue[i];
const index = currentLevelData.findIndex(item => item[this.valueKey] === value);
-
+ this.levelList[i] = currentLevelData; // 璁剧疆姣忎竴灞傜骇鐨勬暟鎹�
+
if (index !== -1) {
this.selectedValueIndexs.push(index);
// 鏇存柊涓嬩竴绾х殑鏁版嵁
@@ -234,6 +244,7 @@
}
},
close() {
+ this.$emit('cancel');
this.$emit('update:show', false);
},
tabsChange(item) {
@@ -241,17 +252,17 @@
levelChange(levelIndex, index) {
// 璁剧疆褰撳墠绾х殑閫変腑鍊�
this.$set(this.selectedValueIndexs, levelIndex, index);
-
+
// 娓呴櫎鍚庣画绾у埆鐨勯�変腑鍊�
this.selectedValueIndexs.splice(levelIndex + 1);
this.tabsIndex = Math.min(this.tabsIndex, levelIndex);
-
+
// 娓呴櫎鍚庣画绾у埆鐨勫垪琛�
this.levelList.splice(levelIndex + 1);
-
+
// 鑾峰彇褰撳墠閫変腑椤�
const currentItem = this.levelList[levelIndex][index];
-
+
// 濡傛灉鏈夊瓙绾ф暟鎹紝鍒欏垵濮嬪寲涓嬩竴绾�
if (currentItem && currentItem[this.childrenKey] && currentItem[this.childrenKey].length > 0) {
// 纭繚levelList鏁扮粍瓒冲闀�
@@ -267,6 +278,7 @@
if (this.autoClose) {
// 濡傛灉鍚敤鑷姩鍏抽棴锛屽垯瑙﹀彂change浜嬩欢骞跺叧闂�
this.emitChange();
+ this.handleConfirm();
} else {
// 鍚﹀垯鍙Е鍙慶hange浜嬩欢锛屼笉鍏抽棴
this.emitChange(false);
@@ -282,13 +294,13 @@
result.push(this.levelList[i][this.selectedValueIndexs[i]][this.valueKey]);
}
}
-
+
// 鏇存柊confirmValues
this.confirmValues = [...result];
-
+
// 瑙﹀彂change浜嬩欢锛岃繑鍥瀡alue鏁扮粍
this.$emit('change', this.confirmValues);
-
+
// 鏍规嵁鍙傛暟鍐冲畾鏄惁鍏抽棴寮圭獥
if (closePopup) {
this.close();
@@ -302,7 +314,11 @@
this.$emit('update:modelValue', this.confirmValues);
this.$emit('confirm', this.confirmValues);
this.close();
- }
+ },
+ // 璺宠浆鐖惰妭鐐�
+ toFatherIndex(index){
+ this.tabsIndex = index;
+ },
}
}
</script>
@@ -327,9 +343,9 @@
height: 800rpx;
}
}
-
+
// 娣诲姞鎸夐挳鍖哄煙鏍峰紡
.u-cascader-action {
border-top: 1px solid #eee;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3