<template>
  <div class="container">
    <component :is="componentVal" @change="changePage" @recordPageInfo="recordPageInfo"></component>
  </div>
</template>

<script>
import { satelliteIntroduction } from "@/utils/formDatas.js"
import { page, update } from "@/api/website/imageLibrary"

import List from "./list"
import Edit from "./edit"

export default {
  name: "imageLibrary",
  components: {
    List,
    Edit
  },
  data() {
    return {
      componentVal: 'List',
      pageInfo: {
        status: null,
        type: null,
        title: '',
        page: 1,
        limit: 10
      },
      datas: null,
    }
  },
  mounted() {

  },
  methods: {
    recordPageInfo(page) {
      this.pageInfo.status = page.status || null;
      this.pageInfo.type = page.type || null;
      this.pageInfo.title = page.title || '';
      this.pageInfo.page = page.page;
      this.pageInfo.limit = page.limit;
    },
    changePage(name, val = null) {

      this.componentVal = name

      this.$nextTick(() => {
          if (name == 'Edit' && val) {
            this.$bus.$emit('imageLibrary-edit-renderData', val)
          }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
