Skip to content

Commit

Permalink
enhance(cascader): add props watch
Browse files Browse the repository at this point in the history
  • Loading branch information
flsion committed Dec 15, 2023
1 parent be35844 commit 7c63241
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/arco-vue-docs/components/aside-nav/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@
margin: 0 0 4px;
padding: 0 12px;

.aside-nav-item-link {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

&-active {
font-weight: 500;
background-color: var(--color-fill-2) !important;

.aside-nav-item-link {
overflow: hidden;
color: rgb(var(--arcoblue-6));
white-space: nowrap;
text-overflow: ellipsis;
}
}

Expand Down
13 changes: 13 additions & 0 deletions packages/web-vue/components/cascader/cascader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ export default defineComponent({
valueKey,
expandTrigger,
expandChild,
pathMode,
multiple,
} = toRefs(props);
const _value = ref(props.defaultValue);
const _inputValue = ref(props.defaultInputValue);
Expand Down Expand Up @@ -682,6 +684,17 @@ export default defineComponent({
eventHandlers.value?.onChange?.();
};
watch([multiple, pathMode], () => {
const values: any[] = [];
computedValueMap.value.forEach((value, key) => {
const option = leafOptionMap.get(key);
if (option) {
values.push(pathMode.value ? option.pathValue : option.value);
}
});
updateValue(values);
});
const handlePopupVisibleChange = (visible: boolean): void => {
if (computedPopupVisible.value !== visible) {
_popupVisible.value = visible;
Expand Down

0 comments on commit 7c63241

Please sign in to comment.