<image> 真机运行遇到问题
来源:10-6 ssl证书购买和HTTPS配置

6095289
2020-03-08
老师我就是想用实现点击切换图片的效果,模拟器可以,真机调试状态也可以,就是真机直接运行不起来,点击next没有反应,这是什么原因
<view>
<image class="img" src="{{src}}"> </image>
<view>
<button class="next" bindtap="changeImg">next</button>
</view>
</view>
const app = getApp()
Page({
data: {
src: "https://cdn.mom1.cn/?mom=302"
},
//切换图片
changeImg: function() {
const me = this;
// wx.showLoading({
// title: 'loading...',
// });
wx.request({
url: "https://cdn.mom1.cn/?mom=url",
success: function(res) {
if (res.statusCode === 200) {
const data = res.data;
const src = "https://" + data.substr(data.lastIndexOf("//") + 2);
console.log(src);
me.setData({
src: src
});
// wx.hideLoading();
}
}
});
}
})
.img{
width: 100%;
margin-top: 50px;
}
.next{
margin-top: 10px;
}
.save{
margin-top: 5px;
}
写回答
2回答
-
风间影月
2020-03-08
图片在真机里需要让你的微信小程序后端设置的,也就是域,这个是别人的图片吧。这个得配置的
012020-03-08 -
6095289
提问者
2020-03-08
api来源:
https://blog.csdn.net/qq_38081703/article/details/100614679
022020-03-08
相似问题