微信小程序扫一扫带参数跳转页面
作者:互联网
index.wxml
<view class="container"> <button bindtap='getScancode'>扫一扫</button> </view>
index.js
const app = getApp() Page({ data: { result: '' },
onl oad: function() {
}, getScancode: function() { wx.scanCode({ onlyFromCamera: true,//只允许从相机扫码 success: (res) => { wx.navigateTo({ url: '../navigator/navigator?content=' + res.result }) var result = res.result; _this.setData({ result: result, }) } }) } })
要跳转的页面
navigator.wxml
<view> {{content}} </view>
navigator.js
Page({ data: { }, onl oad: function (options) { this.setData({ content: options.content }) },
标签:function,res,微信,扫一扫,content,result,跳转,navigator 来源: https://www.cnblogs.com/-shiyi/p/13761671.html