Почему дочерний компонент не смонтирован? - PullRequest
0 голосов
/ 30 июня 2018

Почему дочерний компонент не смонтирован?

Базовый шаблон:

<TableComponent :data="data">

      <template slot="thead">
        <tr>
          <TableHeader></TableHeader>
        </tr>
      </template>

</TableComponent>

TableComponent

<template>

  <div>
    <table>
      <thead>
      {{ renderThead() }}
      </thead>
      <tbody>

      </tbody>
      <tfoot>

      </tfoot>
    </table>
  </div>

</template>

<script>

  export default {
    name: 'TableComponent',

    props: {
      data: {
        required: true,
        type: [Array, Function]
      },
      itemKey: {
        default: 'id',
      },
    },

    methods: {
      renderThead: function () {
        let method = this.$scopedSlots.thead
          ? this.$scopedSlots.thead
          : () => this.$slots.thead

        console.info(method())

        // return method();

      },
    },

  }
</script>

Это TableHeader компонент:

<template>

  <th>
    {{ name }}
  </th>

</template>

<script>
  export default {
    name: 'TableHeader',

    props: {
      name: {
        type: String
      }
    },

    mounted() {
      console.info("MOUNTED")
    }
  }
</script>

Информация о консоли TableHeader не работает. У вас есть идеи?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...