peng
2 天以前 2fd269af9df3653b058deee57bcd7a9f39ff28e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
  <div v-if="pageData">
    <Index :page-data="pageData" />
  </div>
</template>
 
<script>
import Index from './Index.vue'
import { getTopicData } from '@/api/index'
export default {
  data() {
    return {
      pageData: ""
    }
  },
  components: { Index },
  mounted() {
    // 接收id进行查询
    const id = this.$route.query.id
    this.init(id)
  },
  methods: {
    async init(id) {
      const res = await getTopicData(id)
      if (res.success) {
        console.log(res.result)
        // 直接复用首页就行
        if (res.result.pageData) {
          this.pageData = JSON.parse(res.result.pageData)
        }
      }
    }
  }
}
</script>
 
<style lang="scss" scoped></style>