在uni-app中,可以使用uni.setStorage()方法将后端返回的字段存储到本地的storage中。然后可以使用uni.getStorage()方法获取存储在storage中的字段,并通过判断某个条件来获取新的字段数据。下面是一个示例代码:

// 存储字段到storage中
uni.setStorage({
  key: 'dataField',
  data: '字段数据'  // 后端返回的字段数据
})

// 获取存储在storage中的字段
uni.getStorage({
  key: 'dataField',
  success: function (res) {
    // 判断某个条件来获取新的字段数据
    if (条件) {
      var newDataField = res.data + '新字段数据';  // 新字段数据
      console.log(newDataField);
    }
  }
})

在上述代码中,首先使用uni.setStorage()方法将后端返回的字段存储到storage中,然后使用uni.getStorage()方法获取存储在storage中的字段,并通过判断某个条件来获取新的字段数据。在示例中,新的字段数据是通过在原字段数据后面拼接字符串的方式得到的,你可以根据实际需求来获取新的字段数据

uniapp开发的微信小程序怎么把后端给的一个字段有数据存在storage里面然后通过判断某个条件来获取新的这个数据的字段

原文地址: https://www.cveoy.top/t/topic/iKAN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录