|
- <template>
- <view class="page">
- <view class="btn" @click="tapScan">
- 扫码
- </view>
- </view>
- </template>
-
- <script>
- import scanCodeFun from '@/common/js/scanCodeFun.js';
- export default {
- data() {
- return {}
- },
- methods: {
- init() {
- let _this = this;
- scanCodeFun.scanCodeFun().then(res => {
- console.log(res); //"scanType": "CODABAR"是一维码,QR_CODE是二维码,
- if (!res) return;
- if (res.scanType=="QR_CODE" && res.result != "" && res.result != null && res.result != undefined) {
- this.NAV_TO('./from', {
- AIId: res.result
- }, true);
- }else{
- this.TOAST("无法识别到二维码!");
- return;
- }
- })
- },
- tapScan() {
- this.init();
- }
- },
- mounted() {
- let _this = this;
- setTimeout(function() {
- _this.init();
- }, 100);
- }
- };
- </script>
-
- <style lang="less" scoped>
- @import '~@/common/css/sidepage.less';
- @import '~@/common/css/customlist.less';
- </style>
|