[Vuejs]-Vuetify application breaks upon failed v-img source require statement

0👍

Try this

<template>
  <v-img :src="imageSrc">
    <template #placeholder>
      No image
    </template>
  </v-img>
</template>

<script>
export default {
  ...
  mounted() {
    try {
      this.imageSrc = require(...);
    } catch (e) {
      this.imageSrc = null;
    }
  },
};
</script>

Leave a comment