Skip to content
Discussion options

You must be logged in to vote

Hooray! 🎉

I found the solution. I wrote a custom component Image.vue.

Image.vue
<script setup lang="ts">
import { ref, computed } from "vue";
import { handleBackground } from "../layoutHelper";

const props = defineProps({
  src: { type: String, required: true },
  alt: { type: String, default: "" },
  class: { type: String, default: "" },
  width: { type: String, default: "100%" },
  backgroundSize: { type: String, default: "contain" },
  dim: { type: Boolean, default: false },
  style: { type: Object as () => Record<string, string>, default: () => ({}) },
});

const resolvedSrc = computed(() => {
  const base = import.meta.env.BASE_URL || "/"
  const srcPath = props.src.startsWith("/") ? 

Replies: 6 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@alchemmist
Comment options

Comment options

You must be logged in to vote
1 reply
@alchemmist
Comment options

Comment options

You must be logged in to vote
1 reply
@alchemmist
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@alchemmist
Comment options

Answer selected by alchemmist
Comment options

You must be logged in to vote
1 reply
@alchemmist
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants