一、點擊分享按鈕
二、獲取到地址欄id
三、展現到頁面
複製代碼
一、點擊事件 Vue點擊事件@click javascript
ios
import QRCode from 'qrcode' //那使用哪用
// With promises
QRCode.toDataURL('I am a pony!')
.then(url => {
console.log(url)
})
.catch(err => {
console.error(err)
})
複製代碼
六、點擊事件的方法具體代碼npm
// 點擊分享
share() {
this.show = true;
let url = location.href;//獲取當前地址欄的地址
console.log(url);
QRCode.toDataURL(url)
.then(tpian => {
console.log(tpian);
this.imrUrl = tpian;
})
.catch(err => {
console.error(err);
});
},
複製代碼