Skip to content

Commit

Permalink
fix(tab-pane): throws error when using v-if
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Jul 2, 2021
1 parent 30d0299 commit 49c3f58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Remove `n-calendar`'s useless `console.log`.
- Fix loading-bar disappears unexpectl, closes [#343](https://github.com/TuSimple/naive-ui/issues/343).
- Fix `n-select` doesn't scroll to selected item when menu is opened, closes [#346](https://github.com/TuSimple/naive-ui/issues/346).
- Fix `n-tab-pane` throws error when using v-if.

## 2.15.1 (2021-06-30)

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- 移除 `n-calendar` 无用的 console.log
- 修复 loading-bar 自动消失,关闭 [#343](https://github.com/TuSimple/naive-ui/issues/343)
- 修复 `n-select` 打开菜单时没有自动滚动到选中项,关闭 [#346](https://github.com/TuSimple/naive-ui/issues/346)
- 修复 `n-tab-pane` 在使用 v-if 时报错

## 2.15.1 (2021-06-30)

Expand Down
1 change: 1 addition & 0 deletions src/tabs/src/TabPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const tabPaneProps = {
export type TabPaneProps = ExtractPublicPropTypes<typeof tabPaneProps>

export default defineComponent({
__TAB_PANE__: true,
name: 'TabPane',
alias: ['TabPanel'],
props: tabPaneProps,
Expand Down
6 changes: 5 additions & 1 deletion src/tabs/src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,11 @@ export default defineComponent({
mergedSize,
$slots: { default: defaultSlot, prefix: prefixSlot, suffix: suffixSlot }
} = this
const children = defaultSlot ? flatten(defaultSlot()) : []
const children = defaultSlot
? flatten(defaultSlot()).filter((v) => {
return (v.type as any).__TAB_PANE__ === true
})
: []
const prefix = prefixSlot ? prefixSlot() : null
const suffix = suffixSlot ? suffixSlot() : null
const isCard = type === 'card'
Expand Down

0 comments on commit 49c3f58

Please sign in to comment.