Commit ccc5aa81 authored by 王玉鑫's avatar 王玉鑫

fix: 详情页二维码为空报错修正

parent 620c4ac3
...@@ -20,17 +20,19 @@ const props = withDefaults( ...@@ -20,17 +20,19 @@ const props = withDefaults(
const canvasRef = ref<HTMLCanvasElement>(); const canvasRef = ref<HTMLCanvasElement>();
onMounted(() => { onMounted(() => {
QRCode.toCanvas( if (props.content) {
canvasRef.value, QRCode.toCanvas(
props.content, canvasRef.value,
{ props.content,
width: 68, {
margin: 0, width: 68,
}, margin: 0,
(error) => { },
if (error) console.error(error); (error) => {
console.log('success!'); if (error) console.error(error);
}, console.log('success!');
); },
);
}
}); });
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment