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

<script>
import * as components from './style';
import {PropertyMixin} from '../../service/main-tool-editor-type-mixin';
export default {
    components: {
        ...components
    },
    mixins: [PropertyMixin],
    position: 'mainToolEditorTypeCellTableProp',
    name: 'main-tool-editor-type-cellTableProp',
    data () {
        return {
            val:this.editor.val||'',
            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: {
        initCurrtField () {
            let props = this.instanceInfo.vm.$data;
            let val = _.get(props, this.field);
            if (val !== undefined) {//改为undefined,校验boolean类型false错误
                this.val = val;
            }
        },
        handleChange () {

        }
    },
    mounted(){
            debugger;
            let _this=this;
            if (localStorage.tableProp && localStorage.tableProp != null) {

            } else {
              /*this.$Modal.success({
                  title: "友情提示",
                  content: "请先全局设置！"
              });*/
              return;
            }
            let pageObj = eval('(' + localStorage.tableProp + ')');
            _this.propArr=pageObj;
            _this.initCurrtField();
    },
    watch: {
        val (n, o) {


            if (n === o) {
                return;
            }
            this.setInstanceProps(n);
        }
    }
};
</script>

<style>

</style>
