<template>
  <div id="detail">
    <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" @back="back">
      <template v-slot:info>
        <detail-frame :form="form"></detail-frame>
      </template>
    </mobileMain>
  </div>
</template>

<script>
import detailFrame from '../parts/detail_2.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: channel } = createNamespacedHelpers('channel');
export default {
  name: 'detail',
  props: {},
  components: {
    detailFrame,
  },
  data: function() {
    return {
      form: {},
    };
  },
  created() {
    if (this.id) this.search();
  },
  methods: {
    ...channel(['fetch']),
    async search() {
      let res = await this.fetch(this.id);
      if (this.$checkRes(res)) {
        this.$set(this, `form`, res.data);
      }
    },
    back() {
      this.$router.push({ path: '/live/channel/index' });
    },
  },
  computed: {
    ...mapState(['user']),
    id() {
      return this.$route.query.id;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped></style>
