<script lang="ts" setup>
const props = defineProps<{
src: string // 画像のパス
alt: string // 画像の代替文字列
}>()
</script>
<template>
<img
:src="`/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1536`"
:srcset="`
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=320 320w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=640 640w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=768 768w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1024 1024w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1280 1280w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1536 1536w
`"
:alt="props.alt"
sizes="(max-width: 768px) 100vw, 768px"
/>
</template>
<script lang="ts" setup>
const props = defineProps<{
src: string // 画像のパス
alt: string // 画像の代替文字列
}>()
</script>
https://imagedelivery.net/<ACCOUNT_HASH>/<IMAGE_ID>/<VARIANT_NAME>
https://example.com/cdn-cgi/imagedelivery/<ACCOUNT_HASH>/<IMAGE_ID>/<VARIANT_NAME>
<template>
<img
:src="`/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1536`"
:srcset="`
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=320 320w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=640 640w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=768 768w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1024 1024w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1280 1280w,
/cdn-cgi/imagedelivery/ACCOUNT_HASH/${props.src}/w=1536 1536w
`"
:alt="props.alt"
sizes="(max-width: 768px) 100vw, 768px"
/>
</template>