emptygif
Idioma: Español

Todos los lenguajes y frameworks

Vue single-file component Vue

Un fragmento en Vue para Vue single-file component que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.

Vue single-file component Vue

Archivo
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>

Ejecutamos este fragmento y comparamos los bytes que devolvió.

Sitio oficial: Vue single-file component