<!--
 * @Author: 曹捷
 * @Date: 2021-04-28 11:12:50
 * @LastEditors: 曹捷
 * @LastEditTime: 2021-12-23 14:57:53
 * @Description: 用作系统模版 列表展示模板 默认引入
-->
<template>
  <component :is="type" :hasSearch="hasSearch" :hasBtn="hasBtn" :footerLeft="footerLeft">
    <template #left>
      <slot name="left"></slot>
    </template>
    <template #search>
      <slot name="search"></slot>
    </template>
    <template #btn>
      <slot name="btn"></slot>
    </template>
    <template #footerLeft>
      <slot name="footerLeft"></slot>
    </template>

    <slot></slot>
  </component>
</template>

<script>
import fullTable from './table/fullTable.vue'
import rightTable from './table/rightTable.vue'
import { reactive, toRefs } from 'vue'
export default {
  props: {
    type: {
      type: String,
      default: 'fullTable'
    },
  },
  components: { fullTable, rightTable },
  setup (props, contenxt) {
    let _data = reactive({
      hasSearch: false,
      hasBtn: false,
      footerLeft: false
    })
    if (contenxt.slots.search) {
      _data.hasSearch = true
    }
    if (contenxt.slots.btn) {
      _data.hasBtn = true
    }
    if (contenxt.slots.footerLeft) {
      _data.footerLeft = true
    }
    return {
      ...toRefs(_data)
    }
  }

}
</script>

<style>
</style>