convertBtn.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="templateEditBtnBox" @click="openComponentListWindow" v-if="this.$store.state.template.previewStatus==false">
  3. <i class="el-icon-scissors"></i>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. id: {
  10. type:Number,
  11. default:0
  12. },
  13. dataSort: {
  14. type:Number,
  15. default:0
  16. },
  17. sort:{
  18. type:Number,
  19. default:0
  20. },
  21. type:{
  22. type:Number,
  23. default:0
  24. }
  25. },
  26. data() {
  27. return {
  28. };
  29. },
  30. methods: {
  31. openComponentListWindow(){
  32. //遇到过莫名其妙获取不到content的情况,此时使用这个方法
  33. // let that = this;
  34. // setTimeout(() => {
  35. // //判断编辑的是哪个页面的组件style
  36. // let style = 0;
  37. // console.log(that.dataSort)
  38. // console.log(that.$store.state.template.pageData.index[that.dataSort].content.componentList[that.sort].component_style)
  39. // if(that.$store.state.template.pageStatus==1){
  40. // style = that.$store.state.template.pageData.index[that.dataSort].content.componentList[that.sort].component_style;
  41. // }
  42. // if(that.$store.state.template.pageStatus==2){}
  43. // if(that.$store.state.template.pageStatus==3){
  44. // style = that.$store.state.template.pageData.list[that.dataSort].content.componentList[that.sort].component_style;
  45. // }
  46. // if(that.$store.state.template.pageStatus==4){
  47. // style = that.$store.state.template.pageData.article[that.dataSort].content.componentList[that.sort].component_style;
  48. // }
  49. // if(that.$store.state.template.pageStatus==5){}
  50. // if(that.$store.state.template.pageStatus==6){}
  51. // if(that.$store.state.template.pageStatus==7){}
  52. // let data = {
  53. // id:that.id,
  54. // dataSort:that.dataSort,
  55. // sort:that.sort,
  56. // type:that.type,
  57. // style:style
  58. // }
  59. // console.log(data);
  60. // that.$store.commit('template/setComponentStyleStatus',data);
  61. // },200)
  62. let style = 0;
  63. console.log(this.dataSort)
  64. console.log(this.$store.state.template.pageData.index[this.dataSort].content.componentList[this.sort].component_style)
  65. if(this.$store.state.template.pageStatus==1){
  66. style = this.$store.state.template.pageData.index[this.dataSort].content.componentList[this.sort].component_style;
  67. }
  68. if(this.$store.state.template.pageStatus==2){}
  69. if(this.$store.state.template.pageStatus==3){
  70. style = this.$store.state.template.pageData.list[this.dataSort].content.componentList[this.sort].component_style;
  71. }
  72. if(this.$store.state.template.pageStatus==4){
  73. style = this.$store.state.template.pageData.article[this.dataSort].content.componentList[this.sort].component_style;
  74. }
  75. if(this.$store.state.template.pageStatus==5){}
  76. if(this.$store.state.template.pageStatus==6){}
  77. if(this.$store.state.template.pageStatus==7){}
  78. let data = {
  79. id:this.id,
  80. dataSort:this.dataSort,
  81. sort:this.sort,
  82. type:this.type,
  83. style:style
  84. }
  85. console.log(data);
  86. this.$store.commit('template/setComponentStyleStatus',data);
  87. }
  88. },
  89. mounted() {
  90. },
  91. };
  92. </script>
  93. <style scoped lang="less">
  94. .templateEditBtnBox {
  95. position: absolute;
  96. top: 0;
  97. left: 40px;
  98. display: flex;
  99. align-items: center;
  100. justify-content: center;
  101. cursor: pointer;
  102. margin: 5px;
  103. color: #666;
  104. border: 2px dashed #999;
  105. border-radius: 8px;
  106. background-color: #fff1cc;
  107. width: 38px;
  108. height: 38px;
  109. line-height: 38px;
  110. text-align: center;
  111. font-size: 30px;
  112. transition: all 0.3s;
  113. z-index: 999;
  114. &:hover {
  115. color: #333;
  116. }
  117. }
  118. </style>