ct-component-plus 2.2.13 → 2.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-cascader
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<el-cascader
|
|
3
|
+
ref="cascaderRef"
|
|
4
|
+
:class="[
|
|
5
|
+
ns.b(),
|
|
6
|
+
ns.is('disabled', disabled),
|
|
7
|
+
ns.is('filterable', filterable),
|
|
8
|
+
componentId,
|
|
9
|
+
]"
|
|
10
|
+
v-model="showValue"
|
|
11
|
+
:props="propsShow"
|
|
12
|
+
:options="optionsShow"
|
|
13
|
+
:show-all-levels="showAllLevels"
|
|
14
|
+
:filterable="filterable"
|
|
15
|
+
:clearable="clearable"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
:popper-class="popperClassShow"
|
|
18
|
+
v-bind="{ ...$attrs, ...rawAttr }"
|
|
19
|
+
/>
|
|
10
20
|
<!-- <Teleport :to="appendPanelDom">
|
|
11
21
|
<span>大写的六</span>
|
|
12
22
|
</Teleport> -->
|
|
@@ -91,7 +101,7 @@ watch(
|
|
|
91
101
|
() => props.modelValue,
|
|
92
102
|
(newValue) => {
|
|
93
103
|
getCheckedText();
|
|
94
|
-
}
|
|
104
|
+
},
|
|
95
105
|
);
|
|
96
106
|
const appendPanelDom = document.createElement("div");
|
|
97
107
|
|
|
@@ -153,34 +163,38 @@ watchEffect(async () => {
|
|
|
153
163
|
cbs.afterSearch(res, optionsByApi, showValue);
|
|
154
164
|
}
|
|
155
165
|
});
|
|
156
|
-
} catch (error) {
|
|
166
|
+
} catch (error) {}
|
|
157
167
|
}
|
|
158
168
|
if (isFunction(cbs.defineSearch)) {
|
|
159
169
|
try {
|
|
160
170
|
const defineSearchHandle = await cbs.defineSearch(
|
|
161
171
|
optionsByApi,
|
|
162
|
-
showValue
|
|
172
|
+
showValue,
|
|
163
173
|
);
|
|
164
174
|
if (defineSearchHandle === false) return;
|
|
165
175
|
if (defineSearchHandle) {
|
|
166
176
|
optionsByApi.value = defineSearchHandle;
|
|
167
177
|
}
|
|
168
|
-
} catch (error) {
|
|
178
|
+
} catch (error) {}
|
|
169
179
|
}
|
|
170
180
|
});
|
|
171
181
|
function findLabelsByValues(tree, values) {
|
|
172
|
-
// 通过value值的数组获取label并返回一个包含label的数组
|
|
173
182
|
const result = [];
|
|
183
|
+
const valueKey = props.mapObj?.value || "value";
|
|
184
|
+
const labelKey = props.mapObj?.label || "label";
|
|
185
|
+
const childrenKey = props.mapObj?.children || "children";
|
|
174
186
|
function traverse(node) {
|
|
175
|
-
if (
|
|
176
|
-
result.push(node[
|
|
187
|
+
if (isArray(values) && values.includes(node?.[valueKey])) {
|
|
188
|
+
result.push(node?.[labelKey]);
|
|
177
189
|
}
|
|
178
190
|
|
|
179
|
-
|
|
180
|
-
|
|
191
|
+
const children = node?.[childrenKey];
|
|
192
|
+
if (isArray(children) && children.length > 0) {
|
|
193
|
+
children.forEach(traverse);
|
|
181
194
|
}
|
|
182
195
|
}
|
|
183
196
|
|
|
197
|
+
if (!isArray(tree)) return result;
|
|
184
198
|
tree.forEach(traverse);
|
|
185
199
|
return result;
|
|
186
200
|
}
|
|
@@ -188,7 +202,7 @@ useBuriedParams(props, emit, {
|
|
|
188
202
|
getContent: () => {
|
|
189
203
|
let data = findLabelsByValues(
|
|
190
204
|
optionsShow.value,
|
|
191
|
-
props.multiple ? showValue.value : [showValue.value]
|
|
205
|
+
props.multiple ? showValue.value : [showValue.value],
|
|
192
206
|
);
|
|
193
207
|
if (props.multiple) {
|
|
194
208
|
return data;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:placeholder="startPlaceholder"
|
|
14
14
|
:disabled="disabled"
|
|
15
15
|
filterable
|
|
16
|
-
v-bind="
|
|
16
|
+
v-bind="selectEventList0"
|
|
17
17
|
>
|
|
18
18
|
<el-option
|
|
19
19
|
v-for="item in yearList"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
filterable
|
|
39
39
|
:disabled="disabled"
|
|
40
40
|
:filter-method="filterHandleE"
|
|
41
|
-
v-bind="
|
|
41
|
+
v-bind="selectEventList1"
|
|
42
42
|
>
|
|
43
43
|
<el-option
|
|
44
44
|
v-for="item in yearList"
|
|
@@ -187,6 +187,18 @@ const eventList1 = {
|
|
|
187
187
|
onFocus(value, 1);
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
|
+
const selectEventList0 = computed(() => {
|
|
191
|
+
return {
|
|
192
|
+
...(props.rawAttr || {}),
|
|
193
|
+
...eventList0,
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
const selectEventList1 = computed(() => {
|
|
197
|
+
return {
|
|
198
|
+
...(props.rawAttr || {}),
|
|
199
|
+
...eventList1,
|
|
200
|
+
};
|
|
201
|
+
});
|
|
190
202
|
const onChange = (value, index) => {
|
|
191
203
|
emit("changeSelect", value, index);
|
|
192
204
|
};
|