CathyChannn
CathyChannn
  • 发布:2023-11-15 16:34
  • 更新:2023-11-15 16:34
  • 阅读:278

【报Bug】支付宝小程序调用uni.cameraContext.takePhoto无响应

分类:uni-app

产品分类: uniapp/小程序/阿里

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win11

第三方开发者工具版本号: 2.9.0

基础库版本号: 2.7.12

项目创建方式: CLI

CLI版本号: 2.9.6

示例代码:
复制代码<template>  
  <view>  
    <camera  
      mode="normal"  
      id="camera"  
      flash="off"  
      frame-size="medium"  
      device-position="back"  
      @ready="onCameraReady"  
      style="width: 100%; height: 300px"  
    />  
  </view>  
</template>  
<script>  
export default {  
  data() {  
    return {  
      cameraContext: '',  
    }  
  },  
  methods: {  
     onCameraReady (e) {  
      this.cameraContext = uni.createCameraContext();  

      this.cameraContext.takePhoto ({  
        quality: 'high',  
        success (res) {  
          console.log (res);  
        },  
        fail (err) {  
          console.log (err);  
        },  
      });  
    }  
  },  
};  
</script>  
<style>  

</style>

操作步骤:

执行以上代码,跑真机

预期结果:

success打印具体内容

实际结果:

success、fail、complete都没打印

bug描述:

1、使用uni-app框架调用uni.cameraContext.takePhoto,报错且该方法无响应,success、fail、complete都没打印
Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
2、在method加上toJSON(){},无报错,但takephoto无响应

但使用支付宝原生框架调用my.cameraContext.takePhoto,正常无报错有响应

2023-11-15 16:34 负责人:无 分享
已邀请:

要回复问题请先登录注册

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容