mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
lazy-load qrcode
This commit is contained in:
parent
97cbc39303
commit
0bcf1b8822
@ -1,8 +1,6 @@
|
||||
import { createRef } from 'preact';
|
||||
import { useEffect } from 'preact/hooks';
|
||||
|
||||
import QRCode from '../lib/qrcode.min';
|
||||
|
||||
export default function Qr(props) {
|
||||
const ref = createRef();
|
||||
//const [qr, setQr] = useState(null);
|
||||
@ -11,13 +9,16 @@ export default function Qr(props) {
|
||||
if (!ref.current) {
|
||||
return;
|
||||
}
|
||||
new QRCode(ref.current, {
|
||||
text: props.data,
|
||||
width: props.width || 300,
|
||||
height: props.width || 300,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
import('../lib/qrcode.min').then((module) => {
|
||||
const QRCode = module.default;
|
||||
new QRCode(ref.current, {
|
||||
text: props.data,
|
||||
width: props.width || 300,
|
||||
height: props.width || 300,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
});
|
||||
});
|
||||
}, [props.data]);
|
||||
|
||||
|
@ -14,7 +14,7 @@ type Tag = {
|
||||
value: string;
|
||||
};
|
||||
|
||||
export class MyDexie extends Dexie {
|
||||
class MyDexie extends Dexie {
|
||||
events!: Table<Event & { id: string }>;
|
||||
tags!: Table<Tag>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user