Vue實現(xiàn)時間軸功能
更新時間:2022年02月27日 14:53:57 作者:張建宇.
這篇文章主要為大家詳細(xì)介紹了Vue實現(xiàn)時間軸功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了Vue實現(xiàn)時間軸功能的具體代碼,供大家參考,具體內(nèi)容如下
<template> ? <div class="container"> ? ? <div class="content"> ? ? ? <div class="coin" v-for="(item,index1) in Math.ceil((list.length+1)/4)" :key="index1" v-show="isShow==index1"> ? ? ? ? <div class="xs_one"></div> ? ? ? ? <div ? ? ? ? ? class="coinAll" ? ? ? ? ? v-for="(item, index) in list" ? ? ? ? ? :key="index" ? ? ? ? ? :class="{ one: index%4==0 }" ? ? ? ? ? v-show="index<(index1+1)*4 && index+1>(index1)*4" ? ? ? ? > ? ? ? ? ? <span ? ? ? ? ? ? :class="{ ? ? ? ? ? ? ? two: (index + 1) % 2 == 0, ? ? ? ? ? ? ? text_active: index == isIndex, ? ? ? ? ? ? }" ? ? ? ? ? > ? ? ? ? ? ? {{ item }} ? ? ? ? ? </span> ? ? ? ? ? <div class="xs" :class="{ xs_active: index == isIndex }"></div> ? ? ? ? ? <img src="../assets/img/coin1.png" alt="" v-show="index == isIndex" /> ? ? ? ? ? <img src="../assets/img/coin2.png" alt="" v-show="index != isIndex" /> ? ? ? ? </div> ? ? ? </div> ? ? ? <div class="paging" :style="{width:Math.ceil((list.length+1)/4)*20+'px'}"> ? ? ? ? <div class="pagings" v-for="(item,index1) in Math.ceil((list.length+1)/4)" :key="index1" @click="tabList(index1)" :class="{is_activ:isShow==index1}">{{index}}</div> ? ? ? </div> ? ? </div> ? </div> </template> ? ? <script> export default { ? data() { ? ? return { ? ? ? list: ["實施方案", "任務(wù)書", "中期檢查", "項目驗收", "分頁功能1","分頁功能1","分頁功能1","分頁功能1","分頁功能2"], //列表 ? ? ? isIndex: 0, //高亮顯示 ? ? ? isShow: 1, //顯示 ? ? }; ? }, ? methods:{ ? ? tabList(idx){ ? ? ? this.isShow=idx ? ? } ? } }; </script> ? ? <style scoped> .content { ? width: 400px; ? height: 120px; ? background: rgb(9, 27, 70); ? position: relative; } .paging{ ? height: 20px; ? position: absolute; ? bottom: 10px; ? left: 50%; ? transform: translate(-50%); } .paging div{ ? width: 15px; ? height: 15px; ? border-radius: 50%; ? background: rgb(120, 120, 120); ? float: left; ? margin-left: 5px; } .coin { ? width: 100%; ? height: 80px; ? background: rgb(9, 27, 70); ? position: relative; ? overflow-x: hidden; } .xs_one { ? width: 100%; ? height: 5px; ? background: rgb(61, 183, 270); ? position: absolute; ? top: 50%; ? left: 0; ? transform: translate(0, -50%); } .coin .coinAll { ? width: 100px; ? height: 100%; ? float: left; ? position: relative; } ? .coin .one { ? margin-left: -50px; } .coin .coinAll img { ? position: absolute; ? top: 50%; ? right: 0; ? transform: translate(0, -50%); } .coin .coinAll .xs { ? width: 100%; ? height: 5px; ? background: rgb(61, 183, 270); ? position: absolute; ? top: 50%; ? left: 0; ? transform: translate(0, -50%); } ? .coin .coinAll span { ? width: 100%; ? color: #fff; ? font-size: 16px; ? position: absolute; ? top: 5px; } .coin .coinAll .two { ? width: 100%; ? color: #fff; ? font-size: 16px; ? position: absolute; ? top: 55px; } ? /* 文字高亮 */ .coin .coinAll .text_active { ? color: rgb(245, 189, 39); } ? /* 線條高亮 */ .coin .coinAll .xs_active { ? background: rgb(245, 189, 39); } .paging .is_activ{ ? background: rgb(26, 82, 229); } </style>
效果如圖
新增分頁
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Vue如何使用Element-ui表單發(fā)送數(shù)據(jù)與多張圖片到后端詳解
在做項目的時候遇到一個問題,前端需要上傳表單到后端,表單數(shù)據(jù)包括文本內(nèi)容和圖片,這篇文章主要給大家介紹了關(guān)于Vue如何使用Element-ui表單發(fā)送數(shù)據(jù)與多張圖片到后端的相關(guān)資料,需要的朋友可以參考下2022-04-04如何在vue3.0+中使用tinymce及實現(xiàn)多圖上傳文件上傳公式編輯功能
本文給大家分享tinymce編輯器如何在vue3.0+中使用tinymce及實現(xiàn)多圖上傳文件上傳公式編輯功能,tinymce安裝方法文中也給大家詳細(xì)介紹了,對vue tinymce實現(xiàn)上傳公式編輯相關(guān)知識感興趣的朋友跟隨小編一起學(xué)習(xí)下吧2021-05-05幾個你不知道的技巧助你寫出更優(yōu)雅的vue.js代碼
本文參考自油管上某個國外大神的公開演講視頻,學(xué)習(xí)了一下覺得很不錯,所以在項目中也使用了這些不錯的技巧。趁周末有空,寫個博客記錄一下2018-06-06