这个问题真的是恶心到我了,分开一个个的写没事,以数据渲染就出现报错,大佬们帮帮忙,万分感谢。
VM453:1 Failed to load local image resource /img/home.png
the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)
代码:
<template>
<view class="page-body">
<view class="swiper">
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{bannerImage}}" wx:key="key">
<swiper-item data-url="{{item.url}}">
<image class="{{item.title}}" wx:if='{{item}}' src="{{item.image}}"></image>
</swiper-item>
</block>
</swiper>
</view>
</view>
</template>
<style>
</style>
<script>
import { createComponent } from '[@mpxjs](/user/mpxjs)/core'
createComponent({
data: {
bannerImage: [
{
"id": 1,
"image": "/../../../img/home.png",
"title": "banner1",
"url": "https://www.baidu.com/"
},
{
"id": 2,
"image": "/../../../img/order.png",
"title": "banner2",
"url": "https://fanyi.baidu.com/"
},
{
"id": 3,
"image": "/../../../img/user.png",
"title": "banner3",
"url": "https://www.jianshu.com/"
}
],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
duration: 500
},
computed: {
}
})
</script>
<script name="json">
module.exports = {
'component': true
}
</script>