uni-app的页面跳转问题

84 阅读1分钟

一页面的跳转 第一种情况:整个对象传入 uni.navigateTo({ url: "/pages/problemRectification/rectificationDetails/rectificationDetails?rowData=" +encodeURIComponent(JSON.stringify(item))}); 在onLoad里面接收 onLoad(option) { this.reportList = JSON.parse(decodeURIComponent(option.rowData)) this.getFileWen() this.getFileWenZG() this.queryForm.fileInstanceId = this.instanceId = getId.timeSplicing() },

第二情况:传入一个 id //分类 goType(item) { let item_id = item.id; uni.navigateTo({ url: './type?item_id=' + item_id});},

//更多分类 (有的时候传 id 有的时候不传id ) gotoType() { uni.navigateTo({url: './type?item_id='});}, 在onLoad里面接收 onLoad(option) {this.TabBoxID = option.item_id}, :uni-app 页面跳转到tabs页面进行 因为跳转页面的叁数不可以用字符串,所以把数据存储到setStorage里面 这个是方法 :gotoStore(item){let storeId = item.id; uni.setStorage({key: 'storeId'data: storeId}) uni.switchTab({url: '/yb_wm/index/index'});} 获取:setStorage里面数据: 在onLoad里面获取: let Store_id = uni.getStorage({key: 'storeId'}) if (Store_id) {this.storeId = Store_id} else {this.storeId = ''} 三下拉刷新进行分页 onReachBottom() { if (this.storeList.length >= this.totalCount) {console.log('已经到底了')} else {this.page++ this.getList()}}, //接口的处理: let newData = data.data.store.store this.storeList = this.storeList.concat(newData) this.totalCount = data.data.totalCount