feat(timeline): 横向排列

This commit is contained in:
sight 2022-04-02 19:06:38 +08:00
parent 8f69699953
commit 34f2c9d992
4 changed files with 102 additions and 11 deletions

View File

@ -111,6 +111,44 @@ export default {
} }
} }
</script> </script>
:::
::: title 水平方向
:::
::: demo
<template>
<lay-timeline direction="horizontal">
<lay-timeline-item title="2015年" >2015年layui 孵化</lay-timeline-item>
<lay-timeline-item title="2016年" >2016年layui 首个版本发布</lay-timeline-item>
<lay-timeline-item title="2017年" >layui里程碑版本1.0发布</lay-timeline-item>
<lay-timeline-item title="2021年" >layui里程碑版本2.0发布</lay-timeline-item>
</lay-timeline>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::
::: title Timeline 属性
:::
::: table
| 属性 | 描述 | 可选值 |
|-----------|------|-----|
| direction | 排列方向 | `horizontal` `vertical` |
::: :::
@ -119,8 +157,8 @@ export default {
::: table ::: table
| | | | | 属性 | 描述 | 可选值 |
| ------ | -------- | --- | |--------|------|-----|
| simple | 简单模式 | -- | | simple | 简单模式 | -- |
| title | 标题 | -- | | title | 标题 | -- |
@ -131,8 +169,8 @@ export default {
::: table ::: table
| | | | | 插槽名 | 描述 | |
| ------ | -------- | --- | |-----|-----| --- |
| dot | 节点 | -- | | dot | 节点 | -- |
::: :::

View File

@ -111,6 +111,10 @@
border-left-color: #FFF; border-left-color: #FFF;
} }
.layui-tab-brief>.layui-tab-head{
background-color: #FFF;
}
.layui-tab-brief>.layui-tab-head>.layui-tab-title .layui-this { .layui-tab-brief>.layui-tab-head>.layui-tab-title .layui-this {
color: @global-primary-color; color: @global-primary-color;
} }
@ -154,10 +158,6 @@
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
} }
.layui-tab-card>.layui-tab-head>.layui-tab-title {
background-color: @global-neutral-color-1;
}
.layui-tab-card>.layui-tab-head>.layui-tab-title li { .layui-tab-card>.layui-tab-head>.layui-tab-title li {
margin-right: -1px; margin-right: -1px;
margin-left: -1px; margin-left: -1px;

View File

@ -59,3 +59,42 @@
.layui-timeline-item:before { .layui-timeline-item:before {
background-color: #eee; background-color: #eee;
} }
.layui-timeline-horizontal .layui-timeline-item {
display: inline-block;
width: 25%;
text-align: center;
padding-top: 10px;
vertical-align: top;
}
.layui-timeline-horizontal .layui-timeline-axis {
left: 47%;
top: -4px;
}
.layui-timeline-horizontal .layui-timeline-item:before {
left: 0px;
top: 5px;
width: 100%;
height: 1px;
}
.layui-timeline-horizontal .layui-timeline-item:first-child:before {
display: block;
}
.layui-timeline-horizontal .layui-timeline-item:last-child:before {
display: block;
}
.layui-timeline-horizontal .layui-timeline-content {
padding: 15px;
}
.layui-timeline-horizontal .layui-timeline-title {
text-align: center;
position: relative;
margin-bottom: 10px;
line-height: 22px;
}

View File

@ -6,10 +6,24 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import "./index.less"; import "./index.less";
import { computed, withDefaults } from "vue";
export interface LayTimelineProps {
direction: "horizontal" | "vertical";
}
const props = withDefaults(defineProps<LayTimelineProps>(), {
direction: "vertical",
});
const timeLineClass = computed(() => [
"layui-timeline",
props.direction === "horizontal" ? "layui-timeline-horizontal" : "",
])
</script> </script>
<template> <template>
<ul class="layui-timeline"> <ul :class="timeLineClass">
<slot></slot> <slot></slot>
</ul> </ul>
</template> </template>