1、ewm云函数
const cloud = require('wx-server-sdk')
cloud.init({
env: 'xxxxxxxx'
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.wxacode.createQRCode({
path:event.urlname,
width: 410
})
const file = await cloud.uploadFile({
cloudPath: 'img.jpg',
fileContent: result.buffer,
})
return file
} catch (err) {
return err
}
}
2、index.js 调用代码
console.log('测试',dname)
wx.cloud.callFunction({
name: "ewm",
data: {
urlname: '../tt index/index?dname=' + dname
},
success: res =>{
console.log('test1',res.result)
this.setData({
ima:res.result.fileID
})
},
fail: err =>{
console.log()
}
})
3、index.wmsl
<view class="wm1">
<image style="width: 200px; height: 200px; background-color: #eeeeee;" src="{{ima}}"></image>
</view>
-------------------------------------------------------------------------------------------------
另,有pages/tt index/index能访问。
扫码后,提示:页面不存在
可以显示网页了;但是参数传递传递不过来?
urlname: 'Page/tt index/index?dname=' + dname
传递不了参数?