测试页面生成二维码1.0
This commit is contained in:
parent
ed980fd261
commit
41bc4cce96
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user