shimily

存储:wx.setStorageSync(\'storage\', this.data.storage)

获取:

that = this; 
wx.getStorage({
      key: \'storage\',
      success: function(res){
        // success
        that.setData({
          storage:res.data
        })
      }
    })

 

==============================================================

index的js:

//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
    storage:\'\'
  },
  onLoad: function () {
    var that = this

  //获取输入值
  getInput:function(e){
    this.setData({
      storage:e.detail.value
    })
  },
  //存储输入值
  saveInput:function(){
    wx.setStorageSync(\'storage\', this.data.storage)
  }

})

跳转页面的js:

var app = getApp();
var that;  
Page( {  
  data: {    
    storage:\'\'
  },  
  onLoad: function(options) {  
    that = this; 
    //获取存储信息
    wx.getStorage({
      key: \'storage\',
      success: function(res){
        // success
        that.setData({
          storage:res.data
        })
      }
    })
  }

})  

 

分类:

技术点:

相关文章:

  • 2022-01-22
  • 2021-09-23
  • 2021-04-09
  • 2022-01-05
  • 2022-12-23
  • 2021-11-29
  • 2021-05-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-12-23
  • 2021-12-30
  • 2021-11-14
相关资源
相似解决方案