detail.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div id="detail">
  3. <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" @back="back">
  4. <template v-slot:info>
  5. <detail-frame :form="form"></detail-frame>
  6. </template>
  7. </mobileMain>
  8. </div>
  9. </template>
  10. <script>
  11. import detailFrame from '../parts/detail_2.vue';
  12. import { mapState, createNamespacedHelpers } from 'vuex';
  13. const { mapActions: channel } = createNamespacedHelpers('channel');
  14. export default {
  15. name: 'detail',
  16. props: {},
  17. components: {
  18. detailFrame,
  19. },
  20. data: function() {
  21. return {
  22. form: {},
  23. };
  24. },
  25. created() {
  26. if (this.id) this.search();
  27. },
  28. methods: {
  29. ...channel(['fetch']),
  30. async search() {
  31. let res = await this.fetch(this.id);
  32. if (this.$checkRes(res)) {
  33. this.$set(this, `form`, res.data);
  34. }
  35. },
  36. back() {
  37. this.$router.push({ path: '/live/channel/index' });
  38. },
  39. },
  40. computed: {
  41. ...mapState(['user']),
  42. id() {
  43. return this.$route.query.id;
  44. },
  45. },
  46. metaInfo() {
  47. return { title: this.$route.meta.title };
  48. },
  49. watch: {
  50. test: {
  51. deep: true,
  52. immediate: true,
  53. handler(val) {},
  54. },
  55. },
  56. };
  57. </script>
  58. <style lang="less" scoped></style>