{{list.icon}}是一个地址路径
timestamp: Date.now(), //时间戳
在开发者里面配置了访问这个路径的白名单,当开发者工具运行这段代码就会报错。
我的小程序运行页面: pages/dealwith/addVehicle/addVehicle
[渲染层网络层错误] Failed to load local image resource /pages/dealwith/addVehicle/
the server responded with a status of 404 (HTTP/1.1 404 Not Found)
(env: Windows,mp,1.06.2404301; lib: 3.4.6)
src="{{list.icon + ‘?timestamp=’ + timestamp }}
这样写
[渲染层网络层错误] Failed to load local image resource /pages/dealwith/addVehicle/undefined
the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)
(env: Windows,mp,1.06.2404301; lib: 3.4.6)
data: {
list: {
icon: ''
},
timestamp: Date.now(), //时间戳
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const lises = {
icon: 'https://etcassistant.obs.cn-south-1.myhuaweicloud.com/user/MainImage.png'
}
this.setData({
list: lises
})
},
<view>
<image style="width: 100%; height: 500rpx;" src="{{list.icon + '?timestamp=' + timestamp }} "></image>
</view>
可能是请求图片要时间这样写会报错,图片地址直接写的data里面没问题
内容图片能正常显示,就是会出现这个报错