<template>
    <div>
        <div   class="borderClass"  :class="isActive?hoverBorder:noclass" >

        </div>
        <div >
            <template v-if="isActive==true">
                <div   :class="isActive?deleteIcon:hideIcon" @click="deleteInstance()">
                    <span class="iconfont icon-reca-shanchu " @click="deleteInstance()"></span>
                </div>
            </template>
        </div>
        <Modal v-model="modal2" width="360">
            <p slot="header" style="color:#f60;text-align:center">
                <Icon type="ios-information-circle"></Icon>
                <span>删除确认</span>
            </p>
            <div style="text-align:center">
                <p>是否删除刚拖动进来的组件？</p>
            </div>
            <div slot="footer">
                <Button type="default"   @click="cancle">取消</Button>
                <Button type="error"  @click="del">确定</Button>
            </div>
        </Modal>
    </div>
</template>

<script>
    /**
     *@author       叶章浩
     *@date         2019/10/14 18:38
     *@Copyright    天源迪科信息技术股份有限公司
     *@Description
     */

    export default {
        name: "commomHoverModal",
        data () {
            return {
                hoverBorder:'hoverBorder',
                noclass:'noclass',
                modal2:false,
                isActive:false,
                deleteIcon:'deleteIcon',
                hideIcon:'hideIcon',
                property:{
                    label : '标签',
                },
                text: 'label',
                styles: {
                    display:'inline-block',
                    width:'40%',
                    height:'60px',
                    lineHeight:'60px',
                    textAlign:'right',
                    fontSize:'15px'
                },
                type: 'label'
            };
        },
        methods:{
            deleteInstance(){

                this.modal2 = true;
            },
            del () {
                this.$store.commit('viewport/deleteData',  this.$store.state.viewport.currentEditInstanceKey);
                this.modal2 = false;
            },
            cancle(){
                this.modal2 = false;
            },

            handleMouseEnter(){
                let currentInstance= this.$store.state.viewport.currentHoverInstanceKey;
                console.log("currentHoverInstanceKey--->"+currentInstance);
                console.log(configPageIde.instances);
                let isContain = configPageIde.instances.indexOf(currentInstance); // 2
                if(isContain==-1){
                    //note 说明是后拖进来的
                    this.isActive=true;
                }
            },
            handleMouseLeave(){
                debugger;
                this.isActive=false;
            }
        },
        created(){

        }
    }
</script>

<style scoped>
    .hoverBorder{
        border:1px solid red;
    }
   .borderClass{
       position: absolute;
       top:0px;
       left:0px;
       width: 100%;
       bottom:0;
   }
    .noclass{

    }
    .hoverBorder{
        border:1px solid red;
    }
    .hideIcon{
        height: 0px;
    }
    .deleteIcon{
        position: absolute;
        top:0px;
        height:30px ;
        right: 0px;
        display: block;
        color: red;
    }
</style>