• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
    當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

    微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法

    來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:28:56
    文檔

    微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法

    微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法:微信小程序 報(bào)錯(cuò):this.setData is not a function 在page中定義的代碼如下,代碼會(huì)報(bào)錯(cuò):this.setData is not a function <strong> pasteEncryptedText:function()</strong>{ let decrypted
    推薦度:
    導(dǎo)讀微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法:微信小程序 報(bào)錯(cuò):this.setData is not a function 在page中定義的代碼如下,代碼會(huì)報(bào)錯(cuò):this.setData is not a function <strong> pasteEncryptedText:function()</strong>{ let decrypted

    微信小程序 報(bào)錯(cuò):this.setData is not a function

    在page中定義的代碼如下,代碼會(huì)報(bào)錯(cuò):this.setData is not a function

    <strong> pasteEncryptedText:function()</strong>{ 
     let decryptedPass = this.data.decryptedPassword; 
     if (decryptedPass == '' ){ 
     wx.showToast({ 
     title: '請(qǐng)先輸入解密密碼', 
     mask: true, 
     success: function (res) { 
     setTimeout(function () { 
     wx.hideToast(); 
     }, 4000); 
     }, 
     }); 
     return; 
     }else{ 
     wx.getClipboardData({ 
     <strong>success: function (res)</strong> { 
     if ( res.data == '' ){ 
     wx.showToast({ 
     title: '剪貼板沒(méi)有內(nèi)容', 
     mask: true, 
     success: function (res) { 
     setTimeout(function () { 
     wx.hideToast(); 
     }, 4000); 
     }, 
     }) 
     }else{ 
     console.log(decryptedPass); 
     console.log(res.data); 
     <strong>this.setData({ 
     encryptedTextDecode: res.data, 
     originalTextDecode: desEncryptedDecrypted.decrypt(res.data, decryptedPass), 
     });</strong> 
     console.log(this.data.originalTextDecode); 
     } 
     } 
     }); 
     } 
     } 
    

    問(wèn)題分析:在函數(shù) pasteEncryptedText()里面嵌套調(diào)用另一個(gè)函數(shù) wx.showToast(),而setData()是在wx.showToast()中調(diào)用的,此時(shí)this.setData() 

    中的this不是page,而是wx.showToast()這個(gè)對(duì)象了 

    解決方法:

    <strong> 在函數(shù)pasteEncryptedText()一開始處將this對(duì)象保存:</strong>let that = this; 
    pasteEncryptedText:function(){ 
     let decryptedPass = this.data.decryptedPassword; 
    <strong>let that = this;</strong> 
    if (decryptedPass == '' ){ 
     wx.showToast({ 
     title: '請(qǐng)先輸入解密密碼', 
     mask: true, 
     success: function (res) { 
     setTimeout(function () { 
     wx.hideToast(); 
     }, 4000); 
     }, 
     }); 
     return; 
    }else{ 
     wx.getClipboardData({ 
     success: function (res) { 
     if ( res.data == '' ){ 
     wx.showToast({ 
     title: '剪貼板沒(méi)有內(nèi)容', 
     mask: true, 
     success: function (res) { 
     setTimeout(function () { 
     wx.hideToast(); 
     }, 4000); 
     }, 
     }) 
     }else{ 
     console.log(decryptedPass); 
     console.log(res.data); 
     <strong> that.setData</strong>({ 
     encryptedTextDecode: res.data, 
     originalTextDecode: desEncryptedDecrypted.decrypt(res.data, decryptedPass), 
     }); 
     console.log(<strong>that.data.originalTextDecode</strong>); 
     } 
     } 
     }); 
    } 
    
    

    如有疑問(wèn)請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望通過(guò)本文能幫助到大家,謝謝大家對(duì)本站的支持!

    聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法

    微信小程序報(bào)錯(cuò):this.setData is not a function的解決辦法:微信小程序 報(bào)錯(cuò):this.setData is not a function 在page中定義的代碼如下,代碼會(huì)報(bào)錯(cuò):this.setData is not a function <strong> pasteEncryptedText:function()</strong>{ let decrypted
    推薦度:
    • 熱門焦點(diǎn)

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: 久久精品视屏| 亚洲欧洲国产精品香蕉网| 欧美成人精品高清视频在线观看| 国产精品看高国产精品不卡| 久久久精品国产亚洲成人满18免费网站| 久久香综合精品久久伊人| 亚洲精品无码不卡| 精品国产VA久久久久久久冰| 国产精品片在线观看手机版 | 亚洲国产精品人久久| 久久久久亚洲精品天堂| 无码乱码观看精品久久 | 青青草国产精品欧美成人| 无码少妇精品一区二区免费动态| 蜜臀久久99精品久久久久久| 国产精品青草久久久久福利99| 久久精品www| 国产精品爱啪在线线免费观看| 久久这里只有精品18| 亚洲精品无码久久久| 无码人妻精品一区二区蜜桃百度| 久久久久久无码国产精品中文字幕 | 亚洲精品无码Av人在线观看国产| 久久精品国产亚洲Aⅴ蜜臀色欲 | 久久99精品国产99久久| 2018国产精华国产精品| 国产麻豆精品久久一二三| 久久综合精品国产二区无码 | 精品国产美女福利到在线不卡| 国产精品久久久久久久| 国产精品精品自在线拍| 精品国产a∨无码一区二区三区| 人妻精品久久无码区| 色国产精品一区在线观看| 久久精品水蜜桃av综合天堂| 久久久久亚洲精品天堂| 国产精品一区二区久久不卡 | 亚洲精品国产自在久久| 亚洲精品欧美精品日韩精品| 久久99精品国产自在现线小黄鸭| 秋霞久久国产精品电影院|