c_banner.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="mobile-config">
  3. <div v-for="(item, key) in rCom" :key="key">
  4. <component
  5. :is="item.components.name"
  6. :configObj="configObj"
  7. ref="childData"
  8. :configNme="item.configNme"
  9. :key="key"
  10. :index="activeIndex"
  11. :num="item.num"
  12. ></component>
  13. </div>
  14. <rightBtn :activeIndex="activeIndex" :configObj="configObj"></rightBtn>
  15. </div>
  16. </template>
  17. <script>
  18. import toolCom from '@/components/mobileConfigRightDiy/index.js';
  19. import rightBtn from '@/components/rightBtn/index.vue';
  20. import { mapState, mapMutations, mapActions } from 'vuex';
  21. export default {
  22. name: 'c_banner',
  23. componentsName: 'home_banner',
  24. components: {
  25. ...toolCom,
  26. rightBtn,
  27. },
  28. props: {
  29. activeIndex: {
  30. type: null,
  31. },
  32. num: {
  33. type: null,
  34. },
  35. index: {
  36. type: null,
  37. },
  38. },
  39. data() {
  40. return {
  41. configObj: {},
  42. rCom: [
  43. {
  44. components: toolCom.c_set_up,
  45. configNme: 'setUp',
  46. },
  47. ],
  48. };
  49. },
  50. watch: {
  51. num(nVal) {
  52. let value = JSON.parse(JSON.stringify(this.$store.state.mobildConfig.defaultArray[nVal]));
  53. this.configObj = value;
  54. },
  55. configObj: {
  56. handler(nVal, oVal) {
  57. this.$store.commit('mobildConfig/UPDATEARR', { num: this.num, val: nVal });
  58. },
  59. deep: true,
  60. },
  61. 'configObj.setUp.tabVal': {
  62. handler(nVal, oVal) {
  63. var arr = [this.rCom[0]];
  64. if (nVal == 0) {
  65. let tempArr = [
  66. {
  67. components: toolCom.c_menu_list,
  68. configNme: 'swiperConfig',
  69. },
  70. ];
  71. this.rCom = arr.concat(tempArr);
  72. } else {
  73. let tempArr = [
  74. {
  75. components: toolCom.c_txt_tab,
  76. configNme: 'imgConfig',
  77. },
  78. {
  79. components: toolCom.c_txt_tab,
  80. configNme: 'docConfig',
  81. },
  82. {
  83. components: toolCom.c_txt_tab,
  84. configNme: 'txtStyle',
  85. },
  86. {
  87. components: toolCom.c_is_show,
  88. configNme: 'isShow',
  89. },
  90. {
  91. components: toolCom.c_bg_color,
  92. configNme: 'bgColor',
  93. },
  94. {
  95. components: toolCom.c_bg_color,
  96. configNme: 'dotColor',
  97. },
  98. {
  99. components: toolCom.c_slider,
  100. configNme: 'lrConfig',
  101. },
  102. {
  103. components: toolCom.c_slider,
  104. configNme: 'mbConfig',
  105. },
  106. ];
  107. this.rCom = arr.concat(tempArr);
  108. }
  109. },
  110. deep: true,
  111. },
  112. },
  113. mounted() {
  114. this.$nextTick(() => {
  115. let value = JSON.parse(JSON.stringify(this.$store.state.mobildConfig.defaultArray[this.num]));
  116. this.configObj = value;
  117. });
  118. },
  119. methods: {
  120. handleSubmit(name) {
  121. let obj = {};
  122. obj.activeIndex = this.activeIndex;
  123. obj.data = this.configObj;
  124. this.add(obj);
  125. },
  126. ...mapMutations({
  127. add: 'mobildConfig/UPDATEARR',
  128. }),
  129. },
  130. };
  131. </script>
  132. <style scoped lang="stylus">
  133. .title-tips
  134. padding-bottom 10px
  135. font-size 14px
  136. color #333
  137. span
  138. margin-right 14px
  139. color #999
  140. </style>