功能从 index 页面跳转到 draw 页面, 并在 draw 页面获取 id 及 imgUrl
index.wxml
- <navigator class='looks-view' wx:for="{{imgUrlNew}}" wx:key="index" url="/pages/draw/draw?id={{item.id}}&imgUrl={{item.img}}">
- <image src='{{item.img}}' class='looks-view-image'></image>
- <text class='looks-view-text'>{{item.name}}</text>
- </navigator>
在 draw.JS 中:
- data: {
- id:'',
- imgUrl:''
- },
- onLoad: function (options) {
- this.setData({
- id: options.id,
- imgUrl: options.imgUrl
- })
- },
来源: http://www.bubuko.com/infodetail-2910791.html