<template>
  <div class="ws-info-select">{{_content}}</div>
</template>

<script>
export default {
  methods: {
    $_getItemByValue(value) {
      const item = this.items.find((e) => {
        return e.value == value;
      })
      return item;
    },
  },
  computed: {
    _content() {
      if (this.value == undefined || !this.items.length) {
        return null;
      } else {
        if (this.$_getItemByValue(this.value)) {
          return this.$_getItemByValue(this.value).text;
        } else {
          return null;
        }
      }
    },
  },
  props: {
    value: {
      type: [Number, String, Array],
      default: null,
    },
    items: {
      type: Array,
      required: true,
    },
  },
};
</script>

<style lang="scss">
@import "../assets/scss/ws-info-select.scss";
</style>