79572698

Date: 2025-04-14 08:37:50
Score: 0.5
Natty:
Report link

There was an answer here, but it was deleted. Answer from a person: spyshiv He helped me a lot. So I'll duplicate part of his answer here.

The problem: your current Celll.vue just renders a raw VNode - it doesn't execute the slot with the passed data. You need to call the slot as a function and pass a string as an argument to the slot.

✅ Solution summary: Update Celll.vue to:Accept vnodes (which are actually slots wrapped in a VNode),And render them as a slot function with a passed string.

// TableComponent.vue

<template>
  <table>
    <tr v-for="(row, rowIndex) in data" :key="rowIndex">
      <Celll
        v-for="(col, colIndex) in columns"
        :key="colIndex"
        :slotFn="col.children.default"
        :row="row"
      />
    </tr>
  </table>
</template>
// Celll.vue

<script>
import { h } from 'vue';

export default {
  props: {
    slotFn: {
      type: Function,
      required: true,
    },
    row: {
      type: Object,
      required: true,
    },
  },
  render() {
    return h('td', null, this.slotFn(this.row));
  },
};
</script>
Reasons:
  • Blacklisted phrase (1): helped me a lot
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: magistr4815