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

carousel BUG!!!渲染问题 #5910

Open
5 tasks done
onlyCK opened this issue Apr 29, 2024 · 4 comments
Open
5 tasks done

carousel BUG!!!渲染问题 #5910

onlyCK opened this issue Apr 29, 2024 · 4 comments
Labels
untriaged need to sort

Comments

@onlyCK
Copy link

onlyCK commented Apr 29, 2024

Describe the bug

轮播卡片自定义,卡片通过for循环遍历渲染,并且数组元素数据和渲染视图同步更新,在carousel内第一个卡片无法更新视图,而后面的卡片都可以更新,触发条件是点击卡片更新元素的字段。

Steps to reproduce

第一个卡片无法更新

const activityData = ref([])
<n-carousel draggable style="padding: 8vw 0 0" :on-update:current-index="handleCurrentIndexUpdate">
	<div class="activity-item1" v-for="(item, index) in activityData" :key="'activity' + index">
		<activity :data="item.data" :bg="item.bg" @change="changeHandle" />
	</div>
</n-carousel>

Link to minimal reproduction

https://www.naiveui.com/zh-CN/light/components/carousel

System Info

Apple M1
13.2.1 (22D68)
"naive-ui": "^2.35.0",

Used Package Manager

pnpm

Validations

@onlyCK onlyCK added the untriaged need to sort label Apr 29, 2024
@jahnli
Copy link
Collaborator

jahnli commented May 6, 2024

提供的复现 最小可复现的示例

@onlyCK
Copy link
Author

onlyCK commented May 7, 2024

子组件<n-config-provider class="bg" :theme="darkTheme"> <div class="main"> <template v-for="(item, index) in data" :key="index"> <div class="num">{{ item.num }}</div> </template> </div> </n-config-provider>

@onlyCK
Copy link
Author

onlyCK commented May 7, 2024

问题代码 <n-carousel draggable :on-update:current-index="handleCurrentIndexUpdate"> <div class="item" v-for="(item, index) in dataArr" :key="'index"> <children :data="item.data" @change="changeHandle" /> </div> </n-carousel> 更改dataArr的值 ,第一个组件的视图不会更新

@onlyCK
Copy link
Author

onlyCK commented May 7, 2024

提供的复现 最小可复现的示例

可提供的代码片段

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

2 participants