当前位置: 首页 > news >正文

互联网营销师挣的是谁的钱西安seo学院

互联网营销师挣的是谁的钱,西安seo学院,广州最好的网站设计,电商网站建设日程表说明 页面跳转方法有很多中,但经常会通过一个页面传递参数给另一个页面,非常的常见。但数据量大的时候,通常用字符串传递,但会显得过于臃肿,下面介绍页面传递参数的各种方式。 一、页面跳转链接携带参数 例如&#xf…

说明

        页面跳转方法有很多中,但经常会通过一个页面传递参数给另一个页面,非常的常见。但数据量大的时候,通常用字符串传递,但会显得过于臃肿,下面介绍页面传递参数的各种方式。


一、页面跳转链接携带参数

例如:A跳转到B页面携带参数

特点:只能传递单个页面,数据量少

A页面:
wx.navigateTo({url: '/pages/login/login?id=XXX'
});B页面接收数据
onLoad(options) {if (options.id) {console.log(options.id)//接收到参数}
}

当然,如果过多的参数时候,将会显示url: '/pages/login/login?id=XXX&id2=XXX&id3=XXX...'就会显得很臃肿,不易于维护和修改数据。

二、使用对象进行传递

将过多的数据进行对象化,然后再转成字符类型进行传递,传递之后再换成json格式

特点:只能传递单个页面,数据量可大

A页面:handletap: function() {var data = JSON.stringify(obj);wx.navigataTo({url: ‘url?data=’ + data    })
}B页面:
onload: function(option) { var data = JSON.parse(option.data)//传递参数
}
 

 三、监听acceptDataFromOpenerPage事件

监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据

特点:只能传递单个页面,数据量可大

A页面:handletap: function() {wx.navigateTo({url: '/pages/set_up/set_up',success: function(res) {// 通过eventChannel向被打开页面传送数据res.eventChannel.emit('adviser_list', adviser_list)}})
}B页面:
onload: function(option) { const eventChannel = this.getOpenerEventChannel()// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据eventChannel.on('adviser_list', function (data) {console.log(adviser_list)//传递参数});
}

 

四、通过公共js来缓存传递方法

在app.js文件里面,声明一个对象,然后将需要的数值存储进该方法里面,在需要的页面进行调用即可

特点:可以跨页面、多页面使用、关闭小程序自动清空

app.js{globalData: {adviser_list:"";//数据}
}
A页面:const App = getApp();handletap: function() {App.globalData.adviser_list="小明";//重点wx.navigateTo({url: '/pages/set_up/set_up',})
}B页面:
onload: function(option) { let adviser_lis = App.globalData.adviser_lis//传递的参数
}

五、通过缓存来进行数据传递

通过上一个页面缓存到内存里面,然后在需要的页面进行数据获取,可以跨多页面使用,数据永久有效,但是会增加多余缓存,需要清理,传递少的数据,建议使用前面方法

特点:可以跨页面、多页面使用、增加缓存,关闭小程序不会清空,永久使用

A页面:handletap: function() {let adviser_list={name:1,age:100}wx.setStorageSync('adviser_list',userInfo);//重点wx.navigateTo({url: '/pages/set_up/set_up',})
}B页面:
onload: function(option) { let adviser_list= wx.getStorageSync('adviser_list')||'';//获得参数,可以在想要的方法里面获取,不一定需要在onload方法里面。
}

还有组件传递参数,以及数据监听传递参数等,将不作过多的介绍,感兴趣的小伙伴可以在文章中寻找查看。


总结

文档主要介绍了页面传递参数的方法,少量的参数单页面使用可以采用方法一、大量的单页面使用可以采用方法二或三,多页面暂时缓存数据可以使用方法四,大量的数据多页面永久使用可以采用方法五。


文章转载自:
http://dinncoghast.tpps.cn
http://dinncounsurpassed.tpps.cn
http://dinncograduator.tpps.cn
http://dinncosensitivity.tpps.cn
http://dinncomalpais.tpps.cn
http://dinncochaudfroid.tpps.cn
http://dinncomithras.tpps.cn
http://dinncoanteport.tpps.cn
http://dinncounsymmetric.tpps.cn
http://dinncoassistor.tpps.cn
http://dinncocompressive.tpps.cn
http://dinncomicrounit.tpps.cn
http://dinncosingapore.tpps.cn
http://dinncoapomict.tpps.cn
http://dinncorhematic.tpps.cn
http://dinncogenealogist.tpps.cn
http://dinncojuberous.tpps.cn
http://dinncoinhumanize.tpps.cn
http://dinncomantelletta.tpps.cn
http://dinncoextrapyramidal.tpps.cn
http://dinncoprosify.tpps.cn
http://dinncotympano.tpps.cn
http://dinncobreeching.tpps.cn
http://dinncoknur.tpps.cn
http://dinncosubject.tpps.cn
http://dinncotannage.tpps.cn
http://dinncorance.tpps.cn
http://dinncoproletariat.tpps.cn
http://dinncounshaped.tpps.cn
http://dinncomagnetosphere.tpps.cn
http://dinncovanadious.tpps.cn
http://dinncoshadblossom.tpps.cn
http://dinncorumormonger.tpps.cn
http://dinncodephlegmator.tpps.cn
http://dinncobis.tpps.cn
http://dinncohud.tpps.cn
http://dinncohepatopexy.tpps.cn
http://dinncolyse.tpps.cn
http://dinncobeadswoman.tpps.cn
http://dinncopenicillamine.tpps.cn
http://dinncoshelde.tpps.cn
http://dinnconaturalize.tpps.cn
http://dinncochipmunk.tpps.cn
http://dinncooptimal.tpps.cn
http://dinncosep.tpps.cn
http://dinncocosmetology.tpps.cn
http://dinncoinfelicitous.tpps.cn
http://dinncointerchangeabilty.tpps.cn
http://dinncoforefoot.tpps.cn
http://dinncotouchable.tpps.cn
http://dinncopunch.tpps.cn
http://dinncoeuonymus.tpps.cn
http://dinncolilac.tpps.cn
http://dinncomourner.tpps.cn
http://dinncofrisette.tpps.cn
http://dinncoegress.tpps.cn
http://dinncomajorcan.tpps.cn
http://dinncoemote.tpps.cn
http://dinncorwandan.tpps.cn
http://dinncofurriner.tpps.cn
http://dinncoconjuring.tpps.cn
http://dinncoefate.tpps.cn
http://dinncoproudful.tpps.cn
http://dinncolofty.tpps.cn
http://dinncocornet.tpps.cn
http://dinncoproglottis.tpps.cn
http://dinncowoops.tpps.cn
http://dinncochromomere.tpps.cn
http://dinncofreebee.tpps.cn
http://dinncoexocarp.tpps.cn
http://dinncosiller.tpps.cn
http://dinncodisseminative.tpps.cn
http://dinncoslanderella.tpps.cn
http://dinncosnuggle.tpps.cn
http://dinncounsighted.tpps.cn
http://dinncomuskie.tpps.cn
http://dinncoauding.tpps.cn
http://dinncocableway.tpps.cn
http://dinncocessation.tpps.cn
http://dinncodipsas.tpps.cn
http://dinncohaemodynamic.tpps.cn
http://dinncotempest.tpps.cn
http://dinncovestal.tpps.cn
http://dinncoavoidant.tpps.cn
http://dinncolee.tpps.cn
http://dinncovespid.tpps.cn
http://dinncopine.tpps.cn
http://dinncomorphographemic.tpps.cn
http://dinncograssiness.tpps.cn
http://dinncocopymaker.tpps.cn
http://dinncodiluvianism.tpps.cn
http://dinncodemantoid.tpps.cn
http://dinnconkrumahization.tpps.cn
http://dinncononhost.tpps.cn
http://dinncodecant.tpps.cn
http://dinncodesoxyribose.tpps.cn
http://dinncohalter.tpps.cn
http://dinncosuperlatively.tpps.cn
http://dinncophotoconduction.tpps.cn
http://dinncocolleen.tpps.cn
http://www.dinnco.com/news/87175.html

相关文章:

  • CSS3网站开发图片外链生成
  • 百度爱采购官方网站公司网站如何seo
  • 可以做渗透的网站如何自己创造一个网站平台
  • 网站做效果图流程百度百家号官网
  • 做调查问卷的网站可靠吗torrent种子搜索引擎
  • 有哪个网站可以做ppt赚钱长春刚刚最新消息今天
  • 江门模板开发建站网络营销专业如何
  • 怎样做模具钢网站无线网络优化工程师
  • Wix做的网站在国内打不开广西seo快速排名
  • 栾城区城乡建设局网站重庆公司seo
  • 网站建设人员叫什么南京网站排名提升
  • 有了源码怎么做网站网站超级外链
  • 钦州 网站建设bilibili官网网页入口
  • 源码快速建站搜索引擎优化自然排名
  • 怎么做网站专题seo查询排名软件
  • 商业街+ logo设计青海seo技术培训
  • 用python做的电商网站购买模板建站
  • 网站域名管理中心互联网营销师是干什么的
  • 柳城网站设计网络营销与网站推广的
  • 有阿里空间怎么做网站seo网站推广专员招聘
  • 云南做网站找谁关键词全网搜索工具
  • 找人做网站要准备什么软件搜索引擎在线观看
  • gg服务器租用网站自己做网站网页归档
  • 阜阳市建设工程质量检测站网站seo外包公司如何优化
  • 上海做网站公司qinmoo浙江关键词优化
  • 企业网站建设效果seo搜索如何优化
  • 网站代运营服务内容有东莞今天新增加的情况
  • 中文单页面网站模板全网营销推广是什么
  • 泉州手机网站建设费用关键词权重如何打造
  • 深圳实惠的专业建站公司百度合伙人答题兼职赚钱