在第一个页面拍照后进入第二个页面,之后返回到第一个页面,页面无法调用拍照功能
发布于 5 年前 作者 xiayuan 12574 次浏览 来自 问答

 takePhoto() {
   // wx.navigateTo({
   //   url: ‘…/testResult/testResult’
   // });
   const ctx = wx.createCameraContext()
   ctx.takePhoto({
     quality: ‘high’,
     success: (res) => {
       console.log(res)
       this.setData({
         src: res.tempImagePath
       })
       app.globalData.src = res.tempImagePath;
       wx.navigateTo({
         url: ‘…/testResult/testResult’
       });
     },
     complete: (res) => {
       
     }
   })
 }

2 回复

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

我已经解决这个问题了,因为样式都是一样的,在项目中我用的是一个template。应该是两个页面调用不同的tamplate,那么问题也就解决了。

回到顶部