img-size.vue 527 Bytes
<template>
  <img v-lazy="currentSrc" :alt="alt">
</template>

<script>
export default {
  name: 'ImgSize',
  props: {
    src: String,
    width: Number,
    height: Number,
    alt: String
  },
  computed: {
    currentSrc() {
      return (this.src || '')
        .replace('{width}', this.width)
        .replace('{height}', this.height);
    }
  },
  methods: {
    onError() {
      this.$el.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
    }
  }
};
</script>

<style>

</style>