refactor
This commit is contained in:
parent
1dbc5fac84
commit
079f0dfd70
|
@ -89,43 +89,43 @@ function share() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
const qrCodeInstance = new QRCodeStyling({
|
||||||
const qrCodeInstance = new QRCodeStyling({
|
width: 512,
|
||||||
width: 512,
|
height: 512,
|
||||||
height: 512,
|
margin: 40,
|
||||||
margin: 40,
|
type: 'canvas',
|
||||||
type: 'canvas',
|
data: url.value,
|
||||||
data: url.value,
|
image: instance.iconUrl ? getStaticImageUrl(instance.iconUrl) : '/favicon.ico',
|
||||||
image: instance.iconUrl ? getStaticImageUrl(instance.iconUrl) : '/favicon.ico',
|
qrOptions: {
|
||||||
qrOptions: {
|
typeNumber: 0,
|
||||||
typeNumber: 0,
|
mode: 'Byte',
|
||||||
mode: 'Byte',
|
errorCorrectionLevel: 'H',
|
||||||
errorCorrectionLevel: 'H',
|
},
|
||||||
|
imageOptions: {
|
||||||
|
hideBackgroundDots: true,
|
||||||
|
imageSize: 0.3,
|
||||||
|
margin: 12,
|
||||||
|
crossOrigin: 'anonymous',
|
||||||
|
},
|
||||||
|
dotsOptions: {
|
||||||
|
color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 18)`).toRgbString(),
|
||||||
|
gradient: {
|
||||||
|
type: 'linear',
|
||||||
|
rotation: 1, // radian
|
||||||
|
colorStops: [
|
||||||
|
{ offset: 0, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 25)`).toRgbString() },
|
||||||
|
{ offset: 0.5, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 20)`).toRgbString() },
|
||||||
|
{ offset: 1, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 6)`).toRgbString() },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
imageOptions: {
|
type: 'classy-rounded',
|
||||||
hideBackgroundDots: true,
|
},
|
||||||
imageSize: 0.3,
|
backgroundOptions: {
|
||||||
margin: 12,
|
color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 97)`).toRgbString(),
|
||||||
crossOrigin: 'anonymous',
|
},
|
||||||
},
|
});
|
||||||
dotsOptions: {
|
|
||||||
color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 18)`).toRgbString(),
|
|
||||||
gradient: {
|
|
||||||
type: 'linear',
|
|
||||||
rotation: 1, // radian
|
|
||||||
colorStops: [
|
|
||||||
{ offset: 0, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 25)`).toRgbString() },
|
|
||||||
{ offset: 0.5, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 20)`).toRgbString() },
|
|
||||||
{ offset: 1, color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 6)`).toRgbString() },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
type: 'classy-rounded',
|
|
||||||
},
|
|
||||||
backgroundOptions: {
|
|
||||||
color: tinycolor(`hsl(${avatarHsl.value.h}, 100, 97)`).toRgbString(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
if (qrCodeEl.value != null) {
|
if (qrCodeEl.value != null) {
|
||||||
qrCodeInstance.append(qrCodeEl.value);
|
qrCodeInstance.append(qrCodeEl.value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue