自定义时间轴

<template>
    <div class="">
        <div class="timeClass" style="width: 100%;height:18px;">
            <div style="float:left;width: 56px;padding-left:14px;paddding-bottom: 4px;height:18px;">
                <div v-if="!firstItemFlag" style="height:14px;width:4px;background: rgba(25, 31, 36, 0.04);border-radius: 0 0 2px 2px;" />
            </div>
            <div style="float:left">{{ time }}</div>
        </div>
        <div style="width: 100%;height:32px;">
            <svg-icon :icon-class="iconClassName" style="height: 32px;width:32px;float:left;" /><div class="titleClass">{{ title }}</div>
        </div>
        <div id="all" style="width: 100%;min-height:175px;margin-top:4px;">
            <div id="leftDiv" style="float: left;width: 56px;padding-left:14px;paddding-top: 4px;min-height:175px;">
                <div v-if="!lastItemFlag" id="leftDiv2" style="min-height:175px;height:100%;width:4px;background: rgba(25, 31, 36, 0.04);border-radius: 2px 2px 0 0;" />
            </div>
            <div style="float:left;padding-top:7px;width:528px;">
                <div>
                    <span style="height: 18px;font-size: 14px;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: rgba(25, 31, 36, 0.56);line-height: 18px;">
                        {{ userNameTitle }}:
                    </span>
                    <span style="margin-left:7px;height: 18px;font-size: 14px;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #191F24;line-height: 18px;">
                        {{ userName }}
                    </span>
                </div>
                <div id="contentDiv" style="margin-top:16px;background: #FFFFFF;border-radius: 4px;border: 1px solid rgba(25, 31, 36, 0.16);width: 100%;padding: 8px 12px 8px 12px;font-size: 14px;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #191F24;line-height: 18px;">
                    {{ contentTitle }}{{ contentTitle !== null && contentTitle !== '' ? ':': '' }}<br>{{ contentInfomation }}

                </div>
                <div style="height: 1px;margin-top:24px;margin-bottom:24px;background: rgba(25, 31, 36, 0.08);width:100%" />
            </div>

        </div>
    </div>
</template>

<script>
export default {
    name: 'TimeLine',
    props: {
        contentTitle: {
            type: String,
            default: null
        },
        contentInfomation: {
            type: String,
            default: null
        },
        userNameTitle: {
            type: String,
            default: null
        },
        userName: {
            type: String,
            default: null
        },
        lastItemFlag: {
            type: Boolean,
            default: true
        },
        firstItemFlag: {
            type: Boolean,
            default: true
        },
        title: {
            type: String,
            default: null
        },
        iconClassName: {
            type: String,
            default: null
        },
        time: {
            type: String,
            default: null
        }
    },
    watch: {
        contentInfomation(val) {
            setTimeout(() => {
                document.getElementById('all').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
                document.getElementById('leftDiv').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
                document.getElementById('leftDiv2').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
            }, 20)
        }
    },
    created() {
        setTimeout(() => {
            document.getElementById('all').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
            document.getElementById('leftDiv').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
            document.getElementById('leftDiv2').style.height = document.getElementById('contentDiv').offsetHeight + 16 + 18 + 7 + 49 + 'px'
        }, 20)
    },
    methods: {
    }
}
</script>
<style>
.titleClass{
    float:left;
    margin-left:24px;
    height: 32px;
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #191F24;
    line-height: 32px;
}
.timeClass {
    height: 18px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(25, 31, 36, 0.56);
    line-height: 18px;
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值