Vue實(shí)現(xiàn)時(shí)間軸效果
本文實(shí)例為大家分享了Vue實(shí)現(xiàn)時(shí)間軸效果的具體代碼,供大家參考,具體內(nèi)容如下
時(shí)間軸上的時(shí)間點(diǎn)數(shù)和描述文本均可自定義設(shè)置
效果圖如下:
①創(chuàng)建時(shí)間軸組件Timeline.vue:
<template> ? <div class="m-timeline-area"> ? ? <div class="m-timeline"> ? ? ? <div ? ? ? ? :class="['m-timeline-item', {'last': n === totalDots}]" ? ? ? ? v-for="n in totalDots" ? ? ? ? :key="n"> ? ? ? ? <div class="u-tail"></div> ? ? ? ? <div class="u-dot"></div> ? ? ? ? <div class="u-content"> ? ? ? ? ? <p>{{ timelineDesc[n-1] }}</p> ? ? ? ? </div> ? ? ? </div> ? ? </div> ? </div> </template> <script> export default { ? name: 'Timeline', ? props: { ? ? timelineDesc: { ? ? ? type: Array, ? ? ? default: () => { ? ? ? ? return [] ? ? ? } ? ? }, ? ? totalDots: { ? ? ? type: Number, ? ? ? default: 3 ? ? } ? } } </script> <style lang="less" scoped> @blue: #1890ff; @green: #52c41a; @red: #f5222d; @gray: rgba(0,0,0,.25); .m-timeline-area { ? width: 360px; ? margin: 30px auto; ? .m-timeline { ? ? .m-timeline-item { ? ? ? position: relative; ? ? ? padding-bottom: 30px; ? ? ? .u-tail { ? ? ? ? position: absolute; ? ? ? ? top: 10px; ? ? ? ? left: 5px; ? ? ? ? height: calc(100% - 10px); ? ? ? ? border-left: 2px solid #e8e8e8; // 實(shí)線 ? ? ? ? // border-left: 2px dotted #e8e8e8; // 點(diǎn)線 ? ? ? ? // border-left: 2px dashed #e8e8e8; // 虛線 ? ? ? } ? ? ? .u-dot { ? ? ? ? position: absolute; ? ? ? ? width: 8px; ? ? ? ? height: 8px; ? ? ? ? border: 2px solid @blue; ? ? ? ? border-radius: 50%; ? ? ? } ? ? ? .u-content { ? ? ? ? position: relative; ? ? ? ? top: -6px; ? ? ? ? margin-left: 25px; ? ? ? ? word-break: break-word; ? ? ? ? line-height: 24px; ? ? ? } ? ? } ? ? .last { ? ? ? .u-tail { ? ? ? ? display: none; ? ? ? } ? ? } ? } } </style>
②在要使用的頁(yè)面引入:
<Timeline :totalDots="5" :timelineDesc="timelineDesc" /> import Timeline from '@/components/Timeline' components: { ? ? Timeline } timelineDesc: ['Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.', 'Create a services site', 'Create a services site', 'Create a services site', 'Create a services site']
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
vue下的elementui輪播圖自適應(yīng)高度問(wèn)題
這篇文章主要介紹了vue下的elementui輪播圖自適應(yīng)高度問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09vue2實(shí)現(xiàn)無(wú)感刷新token的方式詳解
在Web應(yīng)用中,用戶需要通過(guò)認(rèn)證和授權(quán)才能訪問(wèn)受保護(hù)的資源,為了實(shí)現(xiàn)認(rèn)證和授權(quán)功能,通常需要使用Token來(lái)標(biāo)識(shí)用戶身份并驗(yàn)證其權(quán)限,本文給大家介紹了vue2實(shí)現(xiàn)無(wú)感刷新token的方式,需要的朋友可以參考下2024-02-02Vue實(shí)現(xiàn)輸入框回車發(fā)送和粘貼文本與圖片功能
這篇文章主要為大家詳細(xì)介紹了Vue如何實(shí)現(xiàn)聊天輸入框回車發(fā)送、粘貼文本(包括HTML)、粘貼圖片等功能,文中的實(shí)現(xiàn)方法講解詳細(xì),需要的可以參考一下2022-05-05vue實(shí)現(xiàn)手機(jī)驗(yàn)證碼登錄
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)手機(jī)驗(yàn)證碼登錄,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-11-11vue中el-date-picker選擇日期的限制的項(xiàng)目實(shí)踐
ElementUI的el-date-picker使用時(shí),有時(shí)候想要限制用戶選擇的時(shí)間范圍,本文就來(lái)介紹了vue中el-date-picker選擇日期的限制的項(xiàng)目實(shí)踐,感興趣的可以了解一下2023-10-10vue中關(guān)于computed的this指向問(wèn)題
這篇文章主要介紹了vue中關(guān)于computed的this指向問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07vant 解決tab切換插件標(biāo)題樣式自定義的問(wèn)題
這篇文章主要介紹了vant 解決tab切換插件標(biāo)題樣式自定義的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-11-11如何使用sm4js進(jìn)行加密和國(guó)密sm4總結(jié)
近期由于公司項(xiàng)目的需要開(kāi)始研究國(guó)密SM4加密,下面這篇文章主要給大家介紹了關(guān)于如何使用sm4js進(jìn)行加密和國(guó)密sm4的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-04-04vue2.0中g(shù)oods選購(gòu)欄滾動(dòng)算法的實(shí)現(xiàn)代碼
這篇文章主要介紹了vue2.0中g(shù)oods選購(gòu)欄滾動(dòng)算法的實(shí)現(xiàn)代碼,需要的朋友可以參考下2017-05-05