詳解微信小程序Page中data數(shù)據(jù)操作和函數(shù)調(diào)用
微信小程序Page中data數(shù)據(jù)獲取和設(shè)置
一、Page中data數(shù)據(jù)的獲取和設(shè)置:
1、設(shè)置data數(shù)據(jù) this.setData(object)
setData() 參數(shù)格式:接受一個對象,以 key,value 的形式表示將 this.data 中的 key 對應(yīng)的值改變成 value。其中 key 可以非常靈活,以數(shù)據(jù) 路徑的形式給出,如 array[2].message,a.b.c.d,并且不需要在 this.data 中預(yù)先定義。
this.setData({ ; encryptionPage: 'display:block', });
2、獲取data數(shù)據(jù) this.data.object
var text=this.data.text
Page({ data: { encryption: "color: green; border-bottom-color: green; border-bottom-size: 1px; border-bottom-style: solid;", decryption: "color: gray; border-bottom-color: #F5F5F5; border-bottom-size: 1px; border-bottom-style: solid;", encryptionPage:'display:block', decryptionPage:'display:none', originalText:'', encryptedText:'', originalTextDecode:'', encryptedTextDecode:'', encryptedPassword:'', decryptedPassword:'', },
setEncryption: function(e){ this.setData({ encryptionPage: 'display:block', decryptionPage: 'display:none', encryption: "color: green; border-bottom-color: green; border-bottom-size: 1px; border-bottom-style: solid;", decryption: "color: gray; border-bottom-color: #F5F5F5; border-bottom-size: 1px; border-bottom-style: solid;", }) }, )}
如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
- 微信小程序Page中data數(shù)據(jù)操作和函數(shù)調(diào)用方法
- 微信小程序 詳解Page中data數(shù)據(jù)操作和函數(shù)調(diào)用
- 詳解如何使用微信小程序云函數(shù)發(fā)送短信驗證碼
- 詳解在微信小程序的JS腳本中使用Promise來優(yōu)化函數(shù)處理
- 微信小程序常用簡易小函數(shù)總結(jié)
- 微信小程序提取公用函數(shù)到util.js及使用方法示例
- 解決mpvue + vuex 開發(fā)微信小程序vuex輔助函數(shù)mapState、mapGetters不可用問題
- 微信小程序 功能函數(shù)小結(jié)(手機號驗證*、密碼驗證*、獲取驗證碼*)
- 微信小程序 定義全局數(shù)據(jù)、函數(shù)復(fù)用、模版等詳細介紹
- 詳解微信小程序的不同函數(shù)調(diào)用的幾種方法
相關(guān)文章
微信小程序 動態(tài)的設(shè)置圖片的高度和寬度詳解及實例代碼
這篇文章主要介紹了微信小程序 動態(tài)的設(shè)置圖片的高度和寬度詳解及實例代碼的相關(guān)資料,需要的朋友可以參考下2017-02-02Proxy的不可變數(shù)據(jù)優(yōu)點及使用詳解
這篇文章主要為大家介紹了Proxy的不可變數(shù)據(jù)優(yōu)點及使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-03-03