<template> <div class="scan" @click="saoYiSao"> <van-icon name="scan" /> <img class="tishi" src="@/assets/home/tishi.png" alt="扫码打卡"> </div> </template> <script> export default { methods: { saoYiSao () { ZWJSBridge.scan({ "type": "qrCode" }).then(res => { console.log(res) const qrcode = res.text if(qrcode.length>10){ this.$toast.fail('请扫描正确的基地码') return; } this.$router.push({ name: 'MyClassList', query: { qrresult: res.text } }) }).catch(err => { console.log(err) }) }, } } </script> <style lang="scss" scoped> .scan { position: relative; // position:absolute; // right:20px; // top :20px; // z-index :100; color: white; font-size: 50px; .tishi { position: absolute; left: -90px; bottom: -30px; width: 112px; } } </style>