赞
踩
1. 身为一个攻城狮,一定要会看API文档
- // 允许从相机和相册扫码
- uni.scanCode({
- success: function (res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- }
- });
3. 若想赋值给data 中,记得 this 指向的问题
4. 最简单的方法就是用 箭头函数
- data() {
- return {
- scanType: '',
- result: ''
- }
- },
-
- methods: {
- rightClick() {
- // 允许从相机和相册扫码
- uni.scanCode({
- success: (res) => {
- this.scanType = res.result
- this.result = res.result
- }
- });
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。