uni-app 如何生成二维码? 生成到图片上
uni-app 如何生成二维码? 生成到图片上
<template>
<view>
<view class="me_vscodeCase" @click="open">
<u-modal title="线上签约核验二维码" v-model="show" :show-confirm-button="true" :show-cancel-button="true" confirm-text="关闭二维码"
cancel-text="下载二维码" @cancel="cancel(vscodeImg)" @confirm="confirm">
<view class="slot-content">
<image :src="vscodeImg" style="width:300upx;height: 300upx;" mode=""></image>
</view>
</u-modal>
</view>
</view>
</template>
<script>
import QR from "../../static/js/wxqrcode.js";
export default {
data() {
return {
show: false,
vscodeImg: ""
}
},
onShow() {},
methods: {
open() {
this.show = true;
this.vscodeImg = QR.createQrCodeImg('https://www.baidu.com/', {
size: parseInt(300)
})
},
confirm() {
console.log(123)
}
}
}
</script>
<style lang="less" scoped>
.me_vscodeCase {
width: 750upx;
height: 100upx;
background: #f00;
}
</style>
Tony_H5 (作者)
感谢
2018-08-21 23:32