• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答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
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

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

    來源:懂視網(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: '剪貼板沒有內(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); 
     } 
     } 
     }); 
     } 
     } 
    

    問題分析:在函數(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: '剪貼板沒有內(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>); 
     } 
     } 
     }); 
    } 
    
    

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

    聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quá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
    主站蜘蛛池模板: 精品亚洲麻豆1区2区3区| 久久精品国产精品亜洲毛片| 久久夜色精品国产| 国内精品久久久人妻中文字幕| 精品三级AV无码一区| 精品久久久久久无码中文野结衣 | 婷婷精品国产亚洲AV麻豆不片| 亚洲av永久无码精品国产精品| 精品日韩亚洲AV无码| 久久久久亚洲精品天堂久久久久久| 精品国产网红福利在线观看 | 精品国产AV一区二区三区| 无码人妻精品一区二区蜜桃AV| 亚洲精品无码久久久| 国产中老年妇女精品| 中日精品无码一本二本三本| HEYZO无码综合国产精品| 国产精品国产三级国产AⅤ| 日韩在线精品一二三区| 99久久精品国产毛片| 午夜精品久久久久久| 国产精品最新国产精品第十页 | 亚洲国产精品无码久久久久久曰| 中文字幕精品一区二区日本| 久久九九久精品国产免费直播| 大胸国产精品视频| 久久精品国内一区二区三区 | 亚洲精品永久在线观看| 欧美精品VIDEOSEX极品| 久久精品人人做人人妻人人玩| 免费人欧美日韩在线精品| 国产午夜精品一区二区三区不卡 | 久久精品无码免费不卡| 国产三级精品三级在专区 | 亚洲精品无码AV人在线播放| 亚洲精品成人网久久久久久| 日本午夜精品理论片A级APP发布| 麻豆精品| 一级做a爰黑人又硬又粗免费看51社区国产精品视 | 国产精品午夜一级毛片密呀 | 久久精品中文无码资源站|