Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tabs work without tab-pane #809

Closed
07akioni opened this issue Aug 7, 2021 · 4 comments
Closed

Make tabs work without tab-pane #809

07akioni opened this issue Aug 7, 2021 · 4 comments
Assignees
Labels
feature request New feature or request

Comments

@07akioni
Copy link
Collaborator

07akioni commented Aug 7, 2021

This function solves the problem (这个功能解决的问题)

Only use the bar

Expected API (期望的 API)

<n-tabs>
  <n-tab name="123">123</n-tab>
  <n-tab name="456">456</n-tab>
</n-tabs>
@github-actions github-actions bot added the feature request New feature or request label Aug 7, 2021
@XieZongChen XieZongChen self-assigned this Aug 9, 2021
@moolex
Copy link

moolex commented Mar 8, 2022

Current (2.26.1) n-tabs can't works without n-tab-pane, if tab-pane generated from array, in tab it must check array length first, otherwise it will show error with "Cannot read properties of undefined (reading 'props'), Tabs.js:53:40 flatten(slots.default())[0].props.name"

That means we can't use card tab with addable props but without any panes

Expected API

<n-tabs type="card" addable>
  <n-tab-pane v-for="item in items" :key="item.id" :name="item.name">
    Some content
  </n-tab-pane>
</n-tabs>

@07akioni
Copy link
Collaborator Author

07akioni commented Mar 8, 2022

ns we can't use card tab with addable props but

https://www.naiveui.com/zh-CN/os-theme/components/tabs#no-pane.vue

It doesn't work?

@moolex
Copy link

moolex commented Mar 8, 2022

https://codesandbox.io/s/fast-glade-ec1ted?file=/src/App.vue

It works with self-closing n-tabs or static pane in tab but not dynamic panes from array

@07akioni
Copy link
Collaborator Author

07akioni commented Mar 8, 2022

https://codesandbox.io/s/fast-glade-ec1ted?file=/src/App.vue

It works with self-closing n-tabs or static pane in tab but not dynamic panes from array

The main problem is that n-tabs assume` there's at least one child.

jaulz pushed a commit to jaulz/naive-ui that referenced this issue Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants