123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <div class="templateEditBtnBox" @click="openComponentListWindow" v-if="this.$store.state.template.previewStatus==false">
- <i class="el-icon-scissors"></i>
- </div>
- </template>
- <script>
- export default {
- props: {
- id: {
- type:Number,
- default:0
- },
- dataSort: {
- type:Number,
- default:0
- },
- sort:{
- type:Number,
- default:0
- },
- type:{
- type:Number,
- default:0
- }
- },
- data() {
- return {
-
- };
- },
- methods: {
- openComponentListWindow(){
- //遇到过莫名其妙获取不到content的情况,此时使用这个方法
- // let that = this;
- // setTimeout(() => {
- // //判断编辑的是哪个页面的组件style
- // let style = 0;
- // console.log(that.dataSort)
- // console.log(that.$store.state.template.pageData.index[that.dataSort].content.componentList[that.sort].component_style)
- // if(that.$store.state.template.pageStatus==1){
- // style = that.$store.state.template.pageData.index[that.dataSort].content.componentList[that.sort].component_style;
- // }
- // if(that.$store.state.template.pageStatus==2){}
- // if(that.$store.state.template.pageStatus==3){
- // style = that.$store.state.template.pageData.list[that.dataSort].content.componentList[that.sort].component_style;
- // }
- // if(that.$store.state.template.pageStatus==4){
- // style = that.$store.state.template.pageData.article[that.dataSort].content.componentList[that.sort].component_style;
- // }
- // if(that.$store.state.template.pageStatus==5){}
- // if(that.$store.state.template.pageStatus==6){}
- // if(that.$store.state.template.pageStatus==7){}
- // let data = {
- // id:that.id,
- // dataSort:that.dataSort,
- // sort:that.sort,
- // type:that.type,
- // style:style
- // }
- // console.log(data);
- // that.$store.commit('template/setComponentStyleStatus',data);
- // },200)
- let style = 0;
- console.log(this.dataSort)
- console.log(this.$store.state.template.pageData.index[this.dataSort].content.componentList[this.sort].component_style)
- if(this.$store.state.template.pageStatus==1){
- style = this.$store.state.template.pageData.index[this.dataSort].content.componentList[this.sort].component_style;
- }
- if(this.$store.state.template.pageStatus==2){}
- if(this.$store.state.template.pageStatus==3){
- style = this.$store.state.template.pageData.list[this.dataSort].content.componentList[this.sort].component_style;
- }
- if(this.$store.state.template.pageStatus==4){
- style = this.$store.state.template.pageData.article[this.dataSort].content.componentList[this.sort].component_style;
- }
- if(this.$store.state.template.pageStatus==5){}
- if(this.$store.state.template.pageStatus==6){}
- if(this.$store.state.template.pageStatus==7){}
- let data = {
- id:this.id,
- dataSort:this.dataSort,
- sort:this.sort,
- type:this.type,
- style:style
- }
- console.log(data);
- this.$store.commit('template/setComponentStyleStatus',data);
- }
- },
- mounted() {
-
- },
- };
- </script>
- <style scoped lang="less">
- .templateEditBtnBox {
- position: absolute;
- top: 0;
- left: 40px;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- margin: 5px;
- color: #666;
- border: 2px dashed #999;
- border-radius: 8px;
- background-color: #fff1cc;
- width: 38px;
- height: 38px;
- line-height: 38px;
- text-align: center;
- font-size: 30px;
- transition: all 0.3s;
- z-index: 999;
- &:hover {
- color: #333;
- }
- }
- </style>
|