测试页面生成二维码1.0

This commit is contained in:
WindowBird 2025-08-15 17:45:56 +08:00
parent ed980fd261
commit 41bc4cce96

View File

@ -1,10 +1,10 @@
<template> <template>
<view class="page"> <view class="page">
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header"> <view class="qrcode-container">
<uv-qrcode <uv-qrcode
ref="qrcode" ref="qrcode"
:options="options"
:value="value" :value="value"
:options="options"
canvas-id="qrcode" canvas-id="qrcode"
size="300rpx" size="300rpx"
></uv-qrcode> ></uv-qrcode>
@ -19,49 +19,42 @@ export default {
components: { UvQrcode }, components: { UvQrcode },
data() { data() {
return { return {
value: "sb", value: "测试二维码内容",
options: { options: {
useDynamicSize: false,
errorCorrectLevel: "Q", errorCorrectLevel: "Q",
margin: 10, margin: 10,
areaColor: "#fff", areaColor: "#fff"
}
// logo
},
}; };
}, },
onLoad() { onLoad() {
//
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.qrcode.remake({ this.$refs.qrcode.remake({
success: () => { success: () => {
console.log("生成成功"); console.log("二维码生成成功");
}, },
fail: (err) => { fail: (err) => {
console.log(err); console.error("二维码生成失败:", err);
}, }
}); });
}); });
}, }
methods: {
//
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
background: #f5f0e7; background: #f5f0e7;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
} }
.header { .qrcode-container {
width: 100%; padding: 40rpx;
//min-height: 100vh;// background: white;
display: flex; border-radius: 20rpx;
align-items: flex-start; box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
flex-direction: column;
padding: 200rpx 200rpx;
padding-bottom: 40rpx;
} }
</style> </style>