收藏
回答

大家有没有遇到过 cannot read property 'appId' of

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.9.93


- 当前 Bug 的表现(可附上截图)

paused on exception

typeError: cannot read property 'appId' of undefine

- 预期表现

什么叫预期表现

- 复现路径

什么路径

- 提供一个最简复现 Demo

什么demo


就提个问题  这么多事儿

// page/editcard/editcard.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { userName: "司马相如", userphone: "18866668888", userjobpost: "经理", useremail: "123456@126.com", usercompany: "东泰高科装备科技(北京)有限公司", companyaddr: "北京市昌平区宏福创业园15号", pic1: null, pic2: null, card: null, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { this.interval = setInterval(this.drawBall, 100) }, drawBall: function () { const ctx = wx.createCanvasContext('canvas') ctx.setFontSize(20) ctx.fillText(this.data.userName, 10, 25) ctx.setFontSize(15) ctx.fillText(this.data.userjobpost, 100, 25) ctx.setFontSize(15) ctx.fillText(this.data.usercompany, 10, 45) ctx.drawImage("/img/telephone.png", 5, 65, 15, 15) ctx.setFontSize(15) ctx.fillText(this.data.userphone, 25, 80) ctx.drawImage("/img/email.png", 5, 90, 15, 10) ctx.setFontSize(15) ctx.fillText(this.data.useremail, 25, 100) ctx.drawImage("/img/global.png", 5, 108, 17, 15) ctx.setFontSize(15) ctx.fillText(this.data.companyaddr, 25, 120) wx.drawCanvas({ canvasId: 'canvas', actions: ctx.getActions() }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { clearInterval(this.interval) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, chooseAddImg: function () { wx.chooseImage({ count: 1, // sizeType: ['original '], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function (res) { /*var tempFilePaths = res.tempFilePaths self.setData({ imageNotChoosed: false, tempImageSrc: tempFilePaths[0], originImageSrc: tempFilePaths[0], }) loadImgOnImage(self)*/ }, fail: function (res) { /*self.setData({ imageNotChoosed: true })*/ } }) }, SaveCard: function (self, save) { wx.canvasToTempFilePath({ x: 0, y: 0, width: 265, height: 130, destWidth: 212, destHeight: 104, canvasId: 'canvas', success(res) { console.log(res.tempFilePath) app.globalData.usercard[app.globalData.usercardnum] = res.tempFilePath app.globalData.usercardnum++ self.setData({ card: res.tempFilePath, }) } }) }, /*toPvwCard:function(){ var self = this self.SaveCard(self, 1, 0); },*/ toSaveCard: function () { var self = this self.SaveCard(self, 1); }, toSetCard: function () { wx.navigateTo({ url:'../bluetooth/bluetooth' }) }, })
回答关注问题邀请回答
收藏

1 个回答

  • 是小白啊
    是小白啊
    2018-12-11

    按照教程提供下代码片段,不要在原项目操作 :https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html。

    2018-12-11
    有用
    回复
登录 后发表内容