Commit e1cac5bc39bf2ee43521aabeddc0b3609d64cc02
1 parent
cca792f0
add swiper 新闻轮播图
Showing
1 changed file
with
49 additions
and
5 deletions
webintroduce/src/views/home.vue
@@ -80,8 +80,21 @@ | @@ -80,8 +80,21 @@ | ||
80 | <h2>新闻动态</h2> | 80 | <h2>新闻动态</h2> |
81 | </div> | 81 | </div> |
82 | <div class="news-bd"> | 82 | <div class="news-bd"> |
83 | - <div class="focus swiper-container swiper-container-horizontal" id="swiper-container-news"> | ||
84 | - </div> | 83 | + <swiper :options="newswiperOption" ref="newsSwiper" class="focus swiper-container" id="swiper-container-news"> |
84 | + <!-- slides --> | ||
85 | + <swiper-slide class="red-slide" v-for="item in swiperItem" :key="item"> | ||
86 | + <a class="swiper-slide news_a"> | ||
87 | + <div class="news_title"> | ||
88 | + <p title="">{{item.newsTitle}}</p> | ||
89 | + </div> | ||
90 | + <img class="banner" :src="item.imgUrl" alt="" width="100%"> | ||
91 | + </a> | ||
92 | + </swiper-slide> | ||
93 | + | ||
94 | + <!-- Optional controls --> | ||
95 | + <div class="swiper-pagination news-pagination" slot="pagination"></div> | ||
96 | + </swiper> | ||
97 | + | ||
85 | <div class="newslist"> | 98 | <div class="newslist"> |
86 | <ul> | 99 | <ul> |
87 | <li v-for="(news,index) in newsLists" :key="index" @click="goWXnews(news.href)"> | 100 | <li v-for="(news,index) in newsLists" :key="index" @click="goWXnews(news.href)"> |
@@ -123,6 +136,36 @@ export default { | @@ -123,6 +136,36 @@ export default { | ||
123 | // delay: 3000 | 136 | // delay: 3000 |
124 | // }, | 137 | // }, |
125 | }, | 138 | }, |
139 | + newswiperOption:{ | ||
140 | + pagination: '.swiper-pagination', | ||
141 | + paginationClickable: true, | ||
142 | + // pagination: { | ||
143 | + // el: ".swiper-pagination", | ||
144 | + // clickable: true | ||
145 | + // }, | ||
146 | + autoplay: 3000, | ||
147 | + speed: 1000, | ||
148 | + }, | ||
149 | + swiperItem:[ | ||
150 | + { | ||
151 | + "href":"https://mp.weixin.qq.com/s/NcWXfcxjy5t-sqG2yFg6JQ", | ||
152 | + "newsTitle":"中兴智能交通助力西部大发展,建设甘肃省周边“一带一路”沿线城市的智慧停车", | ||
153 | + "imgUrl":"http://www.zte-its.com/Upload/2019-01/20190107134910953.jpg", | ||
154 | + "time":"2019-01-06" | ||
155 | + }, | ||
156 | + { | ||
157 | + "href":"https://mp.weixin.qq.com/s/bO_1as7-8enGR7g4sI_6lw", | ||
158 | + "newsTitle":"【公司要闻】2018年年底,赤峰智慧停车项目正式上线运营", | ||
159 | + "imgUrl":"http://www.zte-its.com/ckfinder/userfiles/images/Snap2(34).jpg", | ||
160 | + "time":"2018-12-30" | ||
161 | + }, | ||
162 | + { | ||
163 | + "href":"https://mp.weixin.qq.com/s/ZJCdWCWCkrxtmOCep9fvwQ", | ||
164 | + "newsTitle":"中兴智能交通荣获”2018中国城市无人化停车十大创新方案”称号", | ||
165 | + "imgUrl":"http://www.zte-its.com/Upload/2019-01/20190114111641907.jpg", | ||
166 | + "time":"2019-01-14" | ||
167 | + } | ||
168 | + ], | ||
126 | newsLists:[ | 169 | newsLists:[ |
127 | { | 170 | { |
128 | "id":"1", | 171 | "id":"1", |
@@ -197,6 +240,7 @@ export default { | @@ -197,6 +240,7 @@ export default { | ||
197 | computed: { | 240 | computed: { |
198 | swiper() { | 241 | swiper() { |
199 | return this.$refs.mySwiper.swiper | 242 | return this.$refs.mySwiper.swiper |
243 | + return this.$refs.newsSwiper.swiper | ||
200 | } | 244 | } |
201 | }, | 245 | }, |
202 | mounted() { | 246 | mounted() { |
@@ -519,9 +563,9 @@ export default { | @@ -519,9 +563,9 @@ export default { | ||
519 | margin-left: 340px; | 563 | margin-left: 340px; |
520 | } | 564 | } |
521 | .news-pagination .swiper-pagination-bullet{ | 565 | .news-pagination .swiper-pagination-bullet{ |
522 | - width:28px; | ||
523 | - height:4px; | ||
524 | - background:rgba(255,255,255,1); | 566 | + width:28px!important; |
567 | + height:4px!important; | ||
568 | + background:rgba(255,255,255,1)!important; | ||
525 | opacity: 0.5; | 569 | opacity: 0.5; |
526 | border-radius:0; | 570 | border-radius:0; |
527 | } | 571 | } |