From 27e703f465eb0a1a84ac2dd6aeab4189ce2eb871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=AD=94=E7=8E=8B?= <40223749+LYErin@users.noreply.github.com> Date: Fri, 2 Jul 2021 17:14:23 +0800 Subject: [PATCH] fix(collapse): defaultExpandedNames doesn't work in accrodion mode (#351) --- CHANGELOG.en-US.md | 2 ++ CHANGELOG.zh-CN.md | 2 ++ src/collapse/src/CollapseItem.tsx | 3 +++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 2bdac78a9..1896b07f4 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -2,6 +2,8 @@ ## Pending +- Fix `n-collapse` the props of defaultExpandedNames does not work, closes [#350](https://github.com/TuSimple/naive-ui/issues/350). + ### Breaking Changes - `n-select` add `render-tag` prop. diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index ffa469d24..bb3b4586c 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -2,6 +2,8 @@ ## Pending +- 修复 `n-collapse` 默认指定展开属性无效,关闭 [#350](https://github.com/TuSimple/naive-ui/issues/350) + ### Breaking Changes - `n-select` 新增 `render-tag` 属性 diff --git a/src/collapse/src/CollapseItem.tsx b/src/collapse/src/CollapseItem.tsx index 2cee5160b..b3b9b074b 100644 --- a/src/collapse/src/CollapseItem.tsx +++ b/src/collapse/src/CollapseItem.tsx @@ -49,6 +49,9 @@ export default defineComponent({ return !~expandedNames.findIndex( (expandedName) => expandedName === name ) + } else if (expandedNames) { + const { value: name } = mergedNameRef + return name !== expandedNames } return true })