I want to create a custom image component in NuxtJS (to pass rgb color and it automatically colorize the image), but I dont get it working that it loads my image when the img in my CustomImage Component get the path passed.
Error:
logotext.png:1 GET http://localhost:8080/@/assets/images/logotext.png 404 (Not
Found)
My CustomImage:
<template>
<img :src="src" :alt="alt" />
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Prop } from 'nuxt-property-decorator';
@Component({})
export default class CustomImage extends Vue {
@Prop({
type: String,
required: true,
})
public src!: string;
@Prop({
type: String,
required: true,
})
public alt!: string;
}
</script>
<CustomImage src="~/assets/images/logotext.png" alt="Logo" />if that doesn't work, move the images to images folder instaticdirectory and use it like<CustomImage src="/images/logotext.png" alt="Logo" />