您的位置:首页 > 科技 > IT业 > 企业网站建设排名_惠州网站建设技术支持_徐州seo管理_引流推广接单

企业网站建设排名_惠州网站建设技术支持_徐州seo管理_引流推广接单

2025/6/28 7:17:14 来源:https://blog.csdn.net/xuanjiong/article/details/147530047  浏览:    关键词:企业网站建设排名_惠州网站建设技术支持_徐州seo管理_引流推广接单
企业网站建设排名_惠州网站建设技术支持_徐州seo管理_引流推广接单

作者是在添加显示轮播图面板指示点时,出现报错信息:

报错原代码(任一页面的.vue文件)

<template><swiper indicator-dots><swiper-item v-for = "item in picture" : key = "item.id"><view><image :src = "item.img"></image></view></swiper-item></swiper>
</template><script>export default {data() {return {title: 'Hello uni',//轮播图数据picture : [{ id: '1', img: "/static/tabs/home_default.png"},{ id: '2', img: "/static/tabs/home_selected.png"}]}},onLoad() {},methods: {}}
</script><style>.content {display: flex;flex-direction: column;align-items: center;justify-content: center;}.text-area {display: flex;justify-content: center;}.title {font-size: 36rpx;color: #8f8f94;}
</style>

其中第三行代码:

<swiper-item v-for = "item in picture" : key = "item.id">
  • v-for 和 :key 之间的 ​等号(=)前后有空格,且 :key 的写法不规范。

  • 正确的写法应该是 v-for="item in picture" :key="item.id"无空格: 直接绑定)。

修改后:

<swiper-item v-for = "item in picture" :key="item.id">

控制台提示信息:

页面预览:

面板指示点成功显示

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com