emptygif
言語: 日本語

すべての言語・フレームワーク

Vue single-file component Vue

/pixel.gif へのリクエストに空の GIF を返す、Vue single-file component 用の Vue スニペット。GIF は起動時に一度だけデコードします。

Vue single-file component Vue

ファイル
Spacer.vue
<script setup>
const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';

defineProps({
  width: { type: Number, default: 1 },
  height: { type: Number, default: 1 },
});
</script>

<template>
  <img :src="EMPTY_GIF" :width="width" :height="height" alt="" aria-hidden="true">
</template>

このスニペットは実行し、返されたバイト列を照合しました。

公式サイト: Vue single-file component