convertBtn.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. //判断编辑的是哪个页面的组件style
  33. let style = 0;
  34. if(this.$store.state.template.pageStatus==1){
  35. style = this.$store.state.template.pageData.index[this.dataSort].content.componentList[this.sort].component_style;
  36. }
  37. if(this.$store.state.template.pageStatus==2){}
  38. if(this.$store.state.template.pageStatus==3){
  39. style = this.$store.state.template.pageData.list[this.dataSort].content.componentList[this.sort].component_style;
  40. }
  41. if(this.$store.state.template.pageStatus==4){
  42. style = this.$store.state.template.pageData.article[this.dataSort].content.componentList[this.sort].component_style;
  43. }
  44. if(this.$store.state.template.pageStatus==5){}
  45. if(this.$store.state.template.pageStatus==6){}
  46. if(this.$store.state.template.pageStatus==7){}
  47. let data = {
  48. id:this.id,
  49. dataSort:this.dataSort,
  50. sort:this.sort,
  51. type:this.type,
  52. style:style
  53. }
  54. console.log(data);
  55. this.$store.commit('template/setComponentStyleStatus',data);
  56. }
  57. },
  58. mounted() {
  59. },
  60. };
  61. </script>
  62. <style scoped lang="less">
  63. .templateEditBtnBox {
  64. position: absolute;
  65. top: 0;
  66. left: 40px;
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. cursor: pointer;
  71. margin: 5px;
  72. color: #666;
  73. background: rgba(255,255,255,0.5);
  74. border-radius: 5px;
  75. width: 30px;
  76. height: 30px;
  77. line-height: 30px;
  78. text-align: center;
  79. font-size: 30px;
  80. transition: all 0.3s;
  81. z-index: 999;
  82. &:hover {
  83. color: #333;
  84. }
  85. }
  86. </style>