<template>
  <div class="formDiv"   @mouseenter="show" @mouseleave="hide">
    <div class="formDiv-left">
      <span v-if="isValidate" style="color: red;">*</span> <Label > {{property.label}}</Label>
    </div>
    <div class="formDiv-right" >
      <div class="ivu-col ivu-col-span-20">
        <Input class="inputStyle" clearable :placeholder=extend.placeholder />
      </div>
      <div class="c-position ivu-col ivu-col-span-4">
        <span >0/{{extend.maxLength}}</span>
      </div>
    </div>
    <commomHoverModal ref="commomHoverModal" ></commomHoverModal>

  </div>
</template>

<script>
import {editSetting} from './property';
import commomHoverModal from '../../common/commomHoverModal'

export default {
    // props: {
    //     text: {
    //         type: String,
    //         default: 'Button Text'
    //     },
    //     type: String,
    //     styles: Object
    // },
    components:{
        commomHoverModal
    },
    data () {
        return {
            isValidate:false,
            property:{
                label : '单行输入框'
            },
            extend:{
                placeholder:""
            },
            text: 'input',
            type: 'input',
            level: editSetting.level
        };
    },
    editSetting,
    name: editSetting.key,
    level: editSetting.level,
    methods:{
        show(){
            this.$refs.commomHoverModal.handleMouseEnter();
        },
        hide(){
            this.$refs.commomHoverModal.handleMouseLeave();
        }
    },
    mounted(){
        debugger;
        this.$nextTick(()=>{
            let currentInstance = this.$store.state.viewport.instances.get(this.$store.state.viewport.currentEditInstanceKey);
            if(currentInstance.data.property.validate){
                //note 如果校验为真
                this.isValidate=true;
            }
        })

    }
};
</script>

<style lang="less" scoped>
  .formDiv{
    display:inline-block;
    line-height: 60px;
    text-align: left;
    .inputStyle{
      /*width:50%;*/
    }
    .formDiv-left {
      display:inline-block;
      width: 35%;
      text-align:right;
      font-size:15px;
      float: left;
      margin: 0 10px;
    }
    .formDiv-right {
      width: 60%;
      position: relative;
      display:inline-block;
      float: right;
      .c-position {
        padding-left: 5px;
        position: absolute;
        right: 0;
        bottom: 12px;
        line-height: initial;
      }
      .ivu-col-span-20 {
        display: block;
        width: 50%;
      }
      .ivu-col-span-4 {
        display: block;
        width: 50%;
      }
    }
  }


</style>
