fix(collapse): default-expanded-names not working

This commit is contained in:
07akioni 2021-06-05 21:30:39 +08:00
parent 06e052150f
commit 3f0714cebf
3 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,9 @@
# CHANGELOG
## Pending
- Fix `n-collapse` `default-expanded-names` not working.
## 2.11.2
### Fixes

View File

@ -1,5 +1,11 @@
# CHANGELOG
## Pending
### Fixes
- 修复 `n-collapse` `default-expanded-names` 不生效
## 2.11.2
### Fixes

View File

@ -29,9 +29,12 @@ import {
const collapseProps = {
...(useTheme.props as ThemeProps<CollapseTheme>),
defaultExpandesNames: [Array, String] as PropType<
string | number | Array<string | number> | null
>,
defaultExpandedNames: {
type: [Array, String] as PropType<
string | number | Array<string | number> | null
>,
default: null
},
expandedNames: [Array, String] as PropType<
string | number | Array<string | number> | null
>,
@ -98,8 +101,9 @@ export default defineComponent({
props: collapseProps,
setup (props, { slots }) {
const { mergedClsPrefixRef } = useConfig(props)
const uncontrolledExpandedNamesRef =
ref<string | number | Array<string | number> | null>(null)
const uncontrolledExpandedNamesRef = ref<
string | number | Array<string | number> | null
>(props.defaultExpandedNames)
const controlledExpandedNamesRef = computed(() => props.expandedNames)
const mergedExpandedNamesRef = useMergedState(
controlledExpandedNamesRef,