son6.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!-- -->
  2. <template>
  3. <div class="son6">
  4. <Three tit="入村路线" :data="data1" @openLook="openLook" />
  5. <Three tit="村内导览" :data="data2" @openLook="openLook" />
  6. </div>
  7. </template>
  8. <script>
  9. import { getInfoApi } from "@/utils/api";
  10. import Three from "@/components/three.vue";
  11. export default {
  12. name: "son6",
  13. components: { Three },
  14. props: {},
  15. data() {
  16. //这里存放数据
  17. return {
  18. data1: {},
  19. data2: {},
  20. };
  21. },
  22. //监听属性 类似于data概念
  23. computed: {},
  24. //监控data中的数据变化
  25. watch: {},
  26. //方法集合
  27. methods: {
  28. openLook(url, type) {
  29. this.$emit("openLook", url, type);
  30. },
  31. },
  32. //生命周期 - 创建完成(可以访问当前this实例)
  33. async created() {
  34. let res = await getInfoApi(Number(this.$route.params.id));
  35. res.data.forEach((v) => {
  36. // console.log(v);
  37. if (v.menuId === 6001) {
  38. this.data1 = v;
  39. return;
  40. } else if (v.menuId === 6002) {
  41. this.data2 = v;
  42. return;
  43. }
  44. });
  45. },
  46. //生命周期 - 挂载完成(可以访问DOM元素)
  47. mounted() {},
  48. beforeCreate() {}, //生命周期 - 创建之前
  49. beforeMount() {}, //生命周期 - 挂载之前
  50. beforeUpdate() {}, //生命周期 - 更新之前
  51. updated() {}, //生命周期 - 更新之后
  52. beforeDestroy() {}, //生命周期 - 销毁之前
  53. destroyed() {}, //生命周期 - 销毁完成
  54. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  55. };
  56. </script>
  57. <style lang='less' scoped>
  58. .son6 {
  59. width: 100%;
  60. height: 100%;
  61. }
  62. </style>