mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
fix(carousel): doesn't work with v-for
children
This commit is contained in:
parent
8579578e6b
commit
58897a73bf
@ -13,6 +13,7 @@
|
||||
- Fix `n-upload` `multiple=false` doesn't work for drag & drop, closes [#363](https://github.com/TuSimple/naive-ui/issues/363).
|
||||
- Fix `n-dropdown`'s inner `<a />`'s style.
|
||||
- Fix `n-menu` tooltip's inner `<a />`'s style, closes [#338](https://github.com/TuSimple/naive-ui/issues/338).
|
||||
- Fix `n-carousel` doesn't work with `v-for` children.
|
||||
|
||||
## 2.15.2 (2021-07-02)
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
- 修复 `n-upload` `multiple=false` 对于拖拽不生效,关闭 [#363](https://github.com/TuSimple/naive-ui/issues/363)
|
||||
- 修复 `n-dropdown` 中 `<a />` 的样式
|
||||
- 修复 `n-menu` tooltip 中 `<a />` 的样式,关闭 [#338](https://github.com/TuSimple/naive-ui/issues/338)
|
||||
- 修复 `n-carousel` 无法使用 `v-for` 的子元素
|
||||
|
||||
## 2.15.2 (2021-07-02)
|
||||
|
||||
|
@ -15,7 +15,8 @@ import { indexMap } from 'seemly'
|
||||
import { on, off } from 'evtd'
|
||||
import { useConfig, useTheme } from '../../_mixins'
|
||||
import type { ThemeProps } from '../../_mixins'
|
||||
import { ExtractPublicPropTypes } from '../../_utils'
|
||||
import { flatten } from '../../_utils'
|
||||
import type { ExtractPublicPropTypes } from '../../_utils'
|
||||
import { carouselLight } from '../styles'
|
||||
import type { CarouselTheme } from '../styles'
|
||||
import style from './styles/index.cssr'
|
||||
@ -235,7 +236,8 @@ export default defineComponent({
|
||||
lengthRef,
|
||||
$slots: { default: defaultSlot }
|
||||
} = this
|
||||
const children = defaultSlot?.().filter((v) => v) || []
|
||||
const children = flatten(defaultSlot?.() || [])
|
||||
console.log(children)
|
||||
const { length } = children
|
||||
lengthRef.value = length
|
||||
const leftOverflowVNode = length ? cloneVNode(children[length - 1]) : null
|
||||
|
Loading…
Reference in New Issue
Block a user