Vue single-file component Vue
قطعهکد Vue برای Vue single-file component که به درخواستهای /pixel.gif با GIF خالی پاسخ میدهد؛ GIF فقط یکبار هنگام راهاندازی دیکود میشود.
Vue single-file component 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>
این قطعهکد را اجرا کردیم و بایتهایی را که برگرداند مقایسه کردیم.