<template>
  <el-form-item>
    <template #label>
      <div :title="prop.label + ' - ' + prop.field">
        {{ prop.label }}
      </div>
    </template>
    <el-input v-model="value" class="prop-editor" type="text" clearable size="small"
              :readonly="prop.readonly" />
  </el-form-item>
</template>
<script>
import IMetaProp from './IMetaProp.ts'

export default {
  mixins: [IMetaProp],
  data() {
    return {
      value: _.get(this.object3D, this.prop.field)
    }
  },
  methods: {
    refreshValue() {
      this.value = _.get(this.object3D, this.prop.field)
    }
  },
  watch: {
    value(newValue) {
      _.set(this.object3D, this.prop.field, newValue)
    }
  }
}
</script>