1.安装vue-qr
npm install vue-qr --save
生产环境安装
2.使用
<template>
<view class="content">
<!-- logoSrc: 二维码中心的icon 也可以不设置 -->
<vue-qr :size="200" :logoSrc="imageUrl"
text="https://blog.csdn.net/qq_46032105/article/details/131097512?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22131097512%22%2C%22source%22%3A%22qq_46032105%22%7D"></vue-qr>
</view>
</template>
<script>
import vueQr from 'vue-qr'
export default {
components: {
vueQr
},
data() {
return {
imageUrl: require('../../static/logo.png'),
}
},
}
</script>
<style>
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
/* 设置二维码的大小 */
img {
width: 250rpx;
height: 250rpx;
}
</style>
3.效果