How to use the vue timeline component

How to use the vue timeline component

This article example shares the specific implementation code of the vue timeline component for your reference. The specific content is as follows

Effect

vue-timeline component (timeline component) code

<template>
    <ul class="timeline-wrapper">
        <li class="timeline-item" v-for="t in timelineList" :key="t.id">
        <div class="timeline-box">
            <div class="out-circle">
                <div class="in-circle"></div>
            </div>
            <div class="long-line"></div>
        </div>
        <div class="timeline-content">
            <div class="timeline-date">{{t.date}}</div>
            <div class="timeline-title">{{ t.title}}</div>
            <div class="timeline-desc">{{ t.content}}</div>
        </div>
    </li>
    </ul>

</template>

<script type="text/babel">
    import Vue from 'vue'
    export default Vue.component('Timeline',{
        name: "Timeline",
        props: {
            timelineList: {
                type: Array,
                default: () => {
                    return []
                }
            }
        }
    })
</script>

<style scoped lang="scss">
    ul.timeline-wrapper {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    /* Timeline */
    .timeline-item {
        position: relative;

        .timeline-box {
            text-align: center;
            position: absolute;

            .out-circle {
                width: 16px;
                height: 16px;
                background: rgba(14, 116, 218, 0.1);
                box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
                /*opacity: 0.1;*/
                border-radius: 50%;
                display: flex;
                align-items: center;

                .in-circle {
                    width: 8px;
                    height: 8px;
                    margin: 0 auto;
                    background: rgba(14, 116, 218, 1);
                    border-radius: 50%;
                    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
                }
            }

            .long-line {
                width: 2px;
                height: 98px;
                background: rgba(14, 116, 218, 1);
                box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
                opacity: 0.1;
                margin-left: 8px;
            }
        }

        .timeline-content {
            box-sizing: border-box;
            margin-left: 20px;
            height: 106px;
            padding: 0 0 0 20px;
            text-align: left;
            margin-bottom: 30px;

            .timeline-title {
                font-size: 14px;
                word-break: break-all;
                margin-bottom: 16px;
                color: #333;
                font-weight: 500;
                /*display: inline;*/
            }

            .timeline-date {
                font-size: 16px;
                color: #333;
                font-weight: 500;
                margin-bottom: 16px;
            }
            .timeline-desc {
                font-size: 14px;
                color: #999999;
            }
        }

    }


    .timeline-item:last-of-type .timeline-content {
        margin-bottom: 0;
    }
</style>

application

// Parent component reference <timeline :timeline-list="dongtai"></timeline>
// Import components. Remember to use your own component path. import Timeline from "./Timeline";
//Declare the array dongtai:[] in the object returned by data()

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Element Timeline implementation

<<:  Mysql string interception and obtaining data in the specified string

>>:  Detailed explanation of Linux netfilter/iptables knowledge points

Recommend

Multiple ways to insert SVG into HTML pages

SVG (Scalable Vector Graphics) is an image format...

How to view mysql binlog (binary log)

For example, when you create a new table or updat...

How to implement web stress testing through Apache Bench

1. Introduction to Apache Bench ApacheBench is a ...

Vue.js implements the nine-grid image display module

I used Vue.js to make a nine-grid image display m...

In-depth analysis of MySQL data type DECIMAL

Preface: When we need to store decimals and have ...

Implementation code for partial refresh of HTML page

Event response refresh: refresh only when request...

Rendering Function & JSX Details

Table of contents 1. Basics 2. Nodes, trees, and ...

The difference between MySQL execute, executeUpdate and executeQuery

The differences among execute, executeUpdate, and...

What is JavaScript anti-shake and throttling

Table of contents 1. Function debounce 1. What is...

What should I do if I want to cancel an incorrect MySQL command?

I typed a wrong mysql command and want to cancel ...

How to install Nginx in a specified location in Centos system

How to install Nginx in a specified location in C...

Detailed explanation of Mysql transaction processing

1. MySQL transaction concept MySQL transactions a...

Collection of 12 practical web online tools

1. Favicon.cc To create ico icon websites online,...

Example of converting timestamp to Date in MySQL

Preface I encountered a situation at work: In the...