[Vuejs]-How to make the loop (v-for) dynamic inside h (Vue.JS) function?

0👍

the problem was solved using a component not a vnode.

let list = ref(['item']);

const comp = defineComponent({
  setup() {
    const arr = computed(() => toastsList.value);

    // or use list.value directly
    return () => h('ul',arr.value.map((v, i) => { return h('li', { key: i }, v) }));
  },
});

createApp(comp).mount('#trial');

Leave a comment