nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
3.45k stars 383 forks source link

Use custom component in Table #1761

Closed duyld2108 closed 3 weeks ago

duyld2108 commented 3 weeks ago

Description

I have a UTable with Pagination, everything is good. But I have a Custom Component to show and update row data info inside Table. Eg.

<UTable :columns=“columns” :row=“paginatedRows”>
    <template #actions-data=“{row}”>
        <CustomComponent :item-data=“row” />
    </template>
<UTable>

Firstly everything is okay, CustomComponent can receive correct prop from row data. But when page changed, item-data passed to CustomComponent didn’t update, It keeps row data from previous page.

How to resolve. Thank you.

noxsii commented 3 weeks ago

Hey bro :) Try to get the CustomComponent a key attribute. Like:

<CustomComponent :item-data="row" :key="row.id" />

duyld2108 commented 3 weeks ago

@noxsii thanks bro. Its work. I meet the basic mistake. LoL