preview.vue 832 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view>
  3. <block v-for="item in initModule" :key="item.id">
  4. <component :is="item.component" :dataVal="item.fields.dataVal" :attrs="item.fields.attrs"
  5. :styles="item.fields.styles" />
  6. </block>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. getTemplatePages
  12. } from "@/api/template.js"
  13. import Mixin from "./Mixin.js"
  14. export default {
  15. mixins: [Mixin],
  16. data() {
  17. return {
  18. initModule: [],
  19. }
  20. },
  21. onLoad(opt) {
  22. const {
  23. type
  24. } = opt
  25. if (type || type == '0') {
  26. this.getPages(type)
  27. }
  28. },
  29. methods: {
  30. getPages(type) {
  31. getTemplatePages(type).then(res => {
  32. const {
  33. page_code_json
  34. } = res.data
  35. if (page_code_json && page_code_json.customPagePart) {
  36. this.initModule = page_code_json.customPagePart
  37. }
  38. })
  39. }
  40. }
  41. }
  42. </script>
  43. <style>
  44. </style>