<template>
    <div style="width: 100%">
         <Container>
            <Select v-model="value" style="width:96.5%;" >
                <Option v-for="item in optionsData" :value="item.value||''" :key="item.value">{{ item.key }}</Option>
            </Select>
        </Container>
    </div>
</template>

<script>
import * as components from './style';
import {PropertyMixin} from '../../service/main-tool-editor-type-mixin';
import eventbus from '../../service/eventbus';
export default {
    components: {
        ...components
    },
    mixins: [PropertyMixin],
    position: 'mainToolEditorTypeInputSelect',
    name: 'main-tool-editor-type-inputSelect',
    data () {
        return {
            propArr:[]
        };
    },
    props: {
        instanceInfo: Object,
        editor: Object
    },
    computed: {
        applicationState () {
            return this.$store.state.application;
        },
        viewportState () {
            return this.$store.state.viewport;
        },
        optionsData () {
            let _data = this.propArr || [];
            return _data;
        }
    },
    methods:{
        initSelectValue(){
            let currentInstance = this.$store.state.viewport.instances.get(this.$store.state.viewport.currentEditInstanceKey);
            //note 为事件新增一项
              if (currentInstance.data.extend.type) {
                 this.value= currentInstance.data.extend.type;
              }
        }
    },
    mounted(){
        let _this=this;
            _this.propArr=configPageIde.inputType;
            _this.initSelectValue();
    },
    watch: {
        value (n, o) {
            debugger;
            if (n === o) {
                return;
            }
            let comVal = '';
            if(n!=="textarea"){
                comVal = "extend.rows";
            }
            eventbus.$emit("computIsShow",{com:comVal});//用来按需隐藏需要隐藏的组件
            debugger;
            let currentInstance = this.$store.state.viewport.instances.get(this.$store.state.viewport.currentEditInstanceKey);
            //note 为事件新增一项
            //  if (currentInstance.data.extend.type) {
            currentInstance.data.extend.type=n;
        }
    }
};
</script>

<style>

</style>
