<template>
  <div class="templateEditBtnBox" @click="openEditWindow" v-if="this.$store.state.template.previewStatus==false">
    <i class="el-icon-setting"></i>
  </div>
</template>

<script>
export default {
  props: {
    id: {
      type:Number,
      default:0
    },
    dataSort: {
      type:Number,
      default:0
    },
    sort:{
      type:Number,
      default:0
    },
    type:{//组件类型 1=新闻(单个) 2=新闻(多个) 3=广告 4=友情链接 5=底部导航 6=静态html组件 7=文字 8=评论
      type:Number,
      default:0
    },
    size:{
      type:Number,
      default:0
    },
    y: {
      type:Number,
      default:0
    }
  },
  data() {
    return {
      
    };
  },
  methods: {
    openEditWindow(){
      let data = {
        id:this.id,
        dataSort:this.dataSort,
        sort:this.sort,
        type:this.type,
        size:this.size,
        y:this.y
      }
      console.log(data);
      //小助手
      this.$store.commit('template/setEditWindowStatus',data);
      //设置组件回显数据
      this.$store.commit('template/setComponentViewData',data);
      //获取全部导航
      this.$store.dispatch('template/getWebsiteCategory',{pageSize:1000});
    }
  },
  mounted() {
    
  },
};
</script>

<style scoped lang="less">
  .templateEditBtnBox {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 5px;
    color: #666;
    //border: 1px solid #000;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-size: 30px;
    transition: all 0.3s;
    z-index: 999;
    background: rgba(255,255,255,0.5);
    &:hover {
      color: #333;
    }
  }
</style>
