Lahat ng language at framework
Vue single-file component Vue
Isang Vue snippet para sa Vue single-file component na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.
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>
Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.