How to render (or create) component instance in table cell

How to render (or create) component instance in table cell

chismxnachismxna Posts: 2Questions: 1Answers: 0

I defined a Vue3 component "mylabel", which including some props, Now I want display some "mylabel" instances in a table cell. How can i do it?

Answers

  • chismxnachismxna Posts: 2Questions: 1Answers: 0
    edited August 2023

    And i tried columns.render and columns.createdCell functions, both are not worked. I think maybe I write wrong code in the functions. Can anyone help me?

    My createdCell function like below:

    import { createApp } from 'vue';
    import MyLabel from './MyLabel.vue';
    
    function myCreatedCell(td, items, rowData, row, col) {
        for (let i in items) {
            let config = {
                prop1: items[i].prop1,
                prop2: items[i].prop2,
                ......
                data: items[i]
            }
            let fd = createApp(MyLabel, config);
            fd.mount(td);
        }
    }
    
Sign In or Register to comment.