Skip to content

Commit

Permalink
小程序增加参数传递以及缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcaffebabe committed Feb 13, 2020
1 parent 367faff commit fb9dd1d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion 移动开发/小程序开发/nav.md
Expand Up @@ -190,4 +190,37 @@ const common = require('common.js')
<template is="staffName" data="{{staffA}}"></template>
```
{% endraw %}
{% endraw %}
## 页面间参数传递
- 页面跳转
```js
wx.navigateTo({
url: './post-detail/post-detail?id='+id,
})
```
```js
onLoad: function (options) {
// 这里可以拿到url的参数
console.log(options.id);
},
```
## 缓存
```js
// 设置缓存
wx.setStorage({
key: '',
data: '',
})
// 获取缓存
wx.getStorage({
key: ,
success: function(res) {},
})
```

0 comments on commit fb9dd1d

Please sign in to comment.