emptygif
语言: 简体中文

所有语言和框架

Vue single-file component Vue

一个用于 Vue single-file component 的 Vue 代码片段,以空 GIF 响应对 /pixel.gif 的请求,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