云服务器网:购买云服务器和VPS必上的网站!

小程序怎么实现页面之间的传参

小程序怎样实现页面之间的传参1.使用url带参数传递数据代码实现:toSomeone:function(event){wx.navigateTo({url:some/some?id=+event.target.id,})}获得传递来的数据onLoad:func

小程序怎样实现页面之间的传参

1.使用url带参数传递数据

代码实现:

toSomeone:function(event){

wx.navigateTo({

url:'some/some?id='+event.target.id,

})

}

获得传递来的数据

onLoad:function(options){

console.log(options)

},

2.使用组件模板 template传递参数

<templateis="good"data="{{data}}"></template>

3.使用缓存传递参数

//缓存数据

wx.setStorage({

key:'userInfo',

data:res.userInfo

})

getUsersInfo:function(){

//读取缓存登录

wx.getStorage({

key:'userInfo',

success:function(res){

this.userInfo=res.userInfo;

}

})

}

本文来源:https://www.yuntue.com/post/79896.html | 云服务器网,转载请注明出处!

关于作者: yuntue

云服务器(www.yuntue.com)是一家专门做阿里云服务器代金券、腾讯云服务器优惠券的网站,这里你可以找到阿里云服务器腾讯云服务器等国内主流云服务器优惠价格,以及海外云服务器、vps主机等优惠信息,我们会为你提供性价比最高的云服务器和域名、数据库、CDN、免费邮箱等企业常用互联网资源。

为您推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注