<template>
  <div class="item" :class="'label__' + item.labelPosition">
    <span class="label">{{ item.label }}</span>
    <span class="showdata"
      ><el-link :href="item.url || '#'">{{ data.value || labels.dynamicValue }}</el-link></span
    >
  </div>
</template>
<script>
import { ft } from '../../../lib/utils.js';

const LABELS = {
  dynamicValue: ft('i18n_common_dynamic_value', '动态数值'),
  label: ft('i18n_common_label', '标签')
};

// 属性信息展示卡 - 单条模式
export default {
  name: 'item-url',
  props: {
    item: {
      type: Object,
      default: function () {
        return {
          labelPosition: 'left',
          label: LABELS.label,
          props: 'myprops',
          url: '#',
          valueDefault: LABELS.dynamicValue
        };
      }
    },
    data: {
      type: Object,
      default: function () {
        return {
          value: LABELS.dynamicValue
        };
      }
    },

    labels: {
      type: Object,
      default: function () {
        return LABELS;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.label__top {
  span.label {
    display: block;
  }
  span.showdata {
    display: block;
    margin-left: 10px;
    a {
      text-decoration: underline;
    }
  }
}
.label__left {
  span.label {
    display: inline-block;
    width: 120px;
  }
  span.showdata {
    display: inline-block;
    margin-left: 10px;
    a {
      text-decoration: underline;
    }
  }
}
</style>
