Vue.js: dynamic computed subcomponents

I have a situation where I want to have computed local subcomponents. My specific case is the cell components of a row of user data data. Something like that:

var DataGridRow = {
    props: ['columns'],
    template: '<tr><component v-for="col in columns" :is="col.component"></component></tr>',
    components: function () {
        var comps = {};
        // Logic here to build subcomponents dynamically
        return comps;
    }
}

In my tests, this did not work.

Does this exist and is not documented, and am I doing it wrong?

If not, is it logical to implement this?

Otherwise, is there a better solution without declaring global components?

EDIT: also discussed here: https://github.com/vuejs/vue/issues/4651

+4
source share
1 answer

, :is , , !

!

0

Source: https://habr.com/ru/post/1665805/


All Articles