东软实训


vue版轮播图

<pre><code class="language-html">&amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html lang=&amp;quot;zh-CN&amp;quot;&amp;gt; &amp;lt;head&amp;gt;     &amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;     &amp;lt;title&amp;gt;vue版轮播图&amp;lt;/title&amp;gt;     &amp;lt;script src=&amp;quot;./vue.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;     &amp;lt;style&amp;gt;         * {             margin: 0;             padding: 0;             box-sizing: border-box;         }         body {             display: flex;             justify-content: center;             height: 100vh;             width: 100%;             align-items: center;             background-color:antiquewhite;         }         #app {             height: 400px;             width: 650px;             position: relative;         }         #app&amp;gt;img {             width: 100%;             height: 100%;             position: absolute;             opacity: 0;             transition: 2.5s;         }         ul {             display: flex;             position: absolute;             bottom: 10px;             right: 10px;         }         li{             list-style: none;             height: 15px;             width: 15px;             border-radius: 50%;             background-color: rgb(152, 29, 29);             border: 2px soid #827f7f;             margin-left: 10px;             cursor: pointer;         }         li:hover {             border-color: rgb(152, 29, 29);             background-color: #827f7f;         }         #app&amp;gt;.selected {             opacity: 1;         }     &amp;lt;/style&amp;gt; &amp;lt;/head&amp;gt; &amp;lt;body&amp;gt;     &amp;lt;div id=&amp;quot;app&amp;quot;&amp;gt;         &amp;lt;img v-for=&amp;quot;(item,index) in src&amp;quot; :src=&amp;quot; './imgs/'+item &amp;quot; :class=&amp;quot;{selected : i===index}&amp;quot;/&amp;gt;         &amp;lt;ul&amp;gt;             &amp;lt;li v-for=&amp;quot;(item,index) in src&amp;quot; @click=&amp;quot;i=index&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;         &amp;lt;/ul&amp;gt;     &amp;lt;/div&amp;gt;     &amp;lt;script&amp;gt;         new Vue({             data(){                return {                 src:['1.jpg','2.avif','3.jpg','4.jpg','5.jpg','6.jpg'],                 i:0,                }             },             methods: {                 fun(){                     this.i=(this.i+1)%6                 }             },             mounted(){                 setInterval(this.fun,5000)             }         }).$mount('#app')     &amp;lt;/script&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt; </code></pre> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=9421f133824dcb9c8cb9f41ef555c220&amp;amp;file=file.png" alt="" /></p>

页面列表

ITEM_HTML