<template>

  <img :src="esrc" :onerror="edefaultImg" style="width:100%;height:100%;">

</template>

<script>
import  { Create,Core }  from 'eye-core';

export default Create({
  name: "EImage",
  props: {
    src: {
      type: String,
      default: function() {
        return '';
      }
    },
    // 网络加载失败的加载图片
    defaultImg: {
      type: String,
      default: function() {
        return 'this.src="' + require("./img/img-default.jpg") + '"';
      }
    }
  },

  data() {
    return {
      esrc:"",
      edefaultImg: ""
    };
  },
  watch: {
    // 监听
    src(val) {
      this.esrc  = Core.util.concatUrl(val)
    }
  },
  onInit() {
     this.esrc  = Core.util.concatUrl(this.src)
     this.edefaultImg = this.defaultImg
  },
  methods: {}
});
</script>