ct-component-plus
Advanced tools
+1
-1
| { | ||
| "name": "ct-component-plus", | ||
| "private": false, | ||
| "version": "2.2.13", | ||
| "version": "2.2.14", | ||
| "type": "module", | ||
@@ -6,0 +6,0 @@ "main": "packages/components/index.js", |
| <template> | ||
| <el-cascader ref="cascaderRef" :class="[ | ||
| ns.b(), | ||
| ns.is('disabled', disabled), | ||
| ns.is('filterable', filterable), | ||
| componentId, | ||
| ]" v-model="showValue" :props="propsShow" :options="optionsShow" :show-all-levels="showAllLevels" | ||
| :filterable="filterable" :clearable="clearable" :disabled="disabled" :popper-class="popperClassShow" | ||
| v-bind="{ ...$attrs, ...rawAttr }" /> | ||
| <el-cascader | ||
| ref="cascaderRef" | ||
| :class="[ | ||
| ns.b(), | ||
| ns.is('disabled', disabled), | ||
| ns.is('filterable', filterable), | ||
| componentId, | ||
| ]" | ||
| v-model="showValue" | ||
| :props="propsShow" | ||
| :options="optionsShow" | ||
| :show-all-levels="showAllLevels" | ||
| :filterable="filterable" | ||
| :clearable="clearable" | ||
| :disabled="disabled" | ||
| :popper-class="popperClassShow" | ||
| v-bind="{ ...$attrs, ...rawAttr }" | ||
| /> | ||
| <!-- <Teleport :to="appendPanelDom"> | ||
@@ -94,3 +104,3 @@ <span>大写的六</span> | ||
| getCheckedText(); | ||
| } | ||
| }, | ||
| ); | ||
@@ -157,3 +167,3 @@ const appendPanelDom = document.createElement("div"); | ||
| }); | ||
| } catch (error) { } | ||
| } catch (error) {} | ||
| } | ||
@@ -164,3 +174,3 @@ if (isFunction(cbs.defineSearch)) { | ||
| optionsByApi, | ||
| showValue | ||
| showValue, | ||
| ); | ||
@@ -171,18 +181,22 @@ if (defineSearchHandle === false) return; | ||
| } | ||
| } catch (error) { } | ||
| } catch (error) {} | ||
| } | ||
| }); | ||
| function findLabelsByValues(tree, values) { | ||
| // 通过value值的数组获取label并返回一个包含label的数组 | ||
| const result = []; | ||
| const valueKey = props.mapObj?.value || "value"; | ||
| const labelKey = props.mapObj?.label || "label"; | ||
| const childrenKey = props.mapObj?.children || "children"; | ||
| function traverse(node) { | ||
| if (!values && values.includes(node[props.mapObj?.value || "value"])) { | ||
| result.push(node[props.mapObj?.label || "label"]); | ||
| if (isArray(values) && values.includes(node?.[valueKey])) { | ||
| result.push(node?.[labelKey]); | ||
| } | ||
| if (node.children && node.children.length > 0) { | ||
| node.children.forEach(traverse); | ||
| const children = node?.[childrenKey]; | ||
| if (isArray(children) && children.length > 0) { | ||
| children.forEach(traverse); | ||
| } | ||
| } | ||
| if (!isArray(tree)) return result; | ||
| tree.forEach(traverse); | ||
@@ -195,4 +209,5 @@ return result; | ||
| optionsShow.value, | ||
| props.multiple ? showValue.value : [showValue.value] | ||
| props.multiple ? showValue.value : [showValue.value], | ||
| ); | ||
| console.log(data, "data", showValue.value); | ||
| if (props.multiple) { | ||
@@ -199,0 +214,0 @@ return data; |
218097
0.11%