Files
docs/node_modules/@vueuse/integrations/useQRCode.mjs

20 lines
432 B
JavaScript
Raw Normal View History

2025-08-27 14:05:33 +08:00
import { toRef, isClient } from '@vueuse/shared';
import QRCode from 'qrcode';
import { shallowRef, watch } from 'vue';
function useQRCode(text, options) {
const src = toRef(text);
const result = shallowRef("");
watch(
src,
async (value) => {
if (src.value && isClient)
result.value = await QRCode.toDataURL(value, options);
},
{ immediate: true }
);
return result;
}
export { useQRCode };