mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2025-12-17 14:05:12 +00:00
20 lines
432 B
JavaScript
20 lines
432 B
JavaScript
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 };
|