first commit
This commit is contained in:
23
node_modules/@vueuse/integrations/dist/useQRCode-DtYpMi-Z.js
generated
vendored
Normal file
23
node_modules/@vueuse/integrations/dist/useQRCode-DtYpMi-Z.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { isClient, toRef } from "@vueuse/shared";
|
||||
import { shallowRef, watch } from "vue";
|
||||
import QRCode from "qrcode";
|
||||
|
||||
//#region useQRCode/index.ts
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { useQRCode as t };
|
||||
Reference in New Issue
Block a user