微信公衆号二維碼海報生成并識别 保存
發表時(shí)間:2020-9-22
發布人(rén):融晨科技
浏覽次數:79
<img :src="imgUrl" alt @touchstart="start" />
<vue-canvas-poster
:widthPixels="300"
:painting="painting"
@success="success"
@fail="fail"
v-show="!imgUrl"
></vue-canvas-poster>
<div @click="start" class="submit_hb">長按下載海報并分享</div>
//data
imgUrl: "",
views: [
{
type: "image",
url: "", // 背景圖 從後台接口中獲取賦值
css: {
width: "750px",
height: "1334px"
}
},
{
type: "qrcode",
content: "", //二維碼 從後台接口獲取賦值
css: {
top: "950px",
left: "260px",
width: "220px",
height: "220px"
}
}
]
//methods中 長按下載
success(src) {
this.imgUrl = src;
},
fail(err) {
console.log("fail53", this.painting);
},
start() {
if (!window.plus) return;
plus.gallery.save(
this.imgUrl,
function() {
alert("保存成功!");
},
function() {
alert("保存失敗,請重試!");
}
);
},