vue部分如下:
<template><view class=""><!-- 轮播图组件 --&法律大学gt;<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular=""><block v-for="(亚热带季风性湿润气候item,index) in swipers" :key="index"><swiper-item><view class="swiper-item" @tap="event(index)"><image :src="item.src" lazy-load style="height: 350upx;"></image></view></swiper-item></block></swiper></view></template>
nvue部分如下:
<template><div><!-- 轮播图组件 --><slider :auto-play="true" :interval="3000" class="slider"><div style="position: relatice;" v-for="(item,index) in swipers" :key="index" @click="event(index)"><image class="image" resize="cover" :s武汉国防科技大学rc="item.src"></image></div><indicator class="indicator"></indicator></slider></div></template>
nvue部分的css样式如下:
<style>.slider,.image{width: 750px;height: 350px;}.indicator{position: absolute;right: 0;bottom: 0;width: 150px;height: 30px;background-color: rgba(0,0,0,0);item-color:rgba(255,255,255王勃滕王阁序,0.5);item-lected-color: #ffffff;}</style>
js部分如下:
vue与nvue的js写法是一样的
<script>export default {data() {return {swipers:[{src:"/sta教师节手抄报题目tic/images/demo/demo4.png"},{src:"/static/images/demo/demo4.png"},{src:"/static/images/demo/demo4.png"},{src:"/static/images/demo/demo4.png"}]}},methods: {event(index){console.log("点击了 index:"+index)}}}</script>
效果图如下:
vue:
nvue:
到此这篇关于uniapp vue与nvue轮播图 轮播图组件的文章就介绍到这了,更多相关uniapp轮播图组件内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 08:21:25,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/eebed0ddbe835fb8b023c5e2103ce1b3.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:uniapp vue与nvue轮播图之轮播图组件的示例代码.doc
本文 PDF 下载地址:uniapp vue与nvue轮播图之轮播图组件的示例代码.pdf
留言与评论(共有 0 条评论) |