1.0.15 • Published 3 years ago

vue-horizontal-line v1.0.15

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Vue Horizontal Line 是一个水平方向(横向)进行多数据展示的组件,最常见的应用场景为水平(横向)时间轴,但也可用于其它类似场景。

支持 Support Vue 2.5+

入门指南 Getting started

安装 Install

# 使用npm
npm install vue-horizontal-line --save

引入 Import

import VueHorizontalLine from 'vue-horizontal-line';

加入到 Vue 组件 Vue Components

export default {
  components: {
    VueHorizontalLine
  }
};

使用 Usage

<template>
    <VueHorizontalLine style="width: 100%; height: 500px; border: 1px solid black;" :items="items" :container-background-color="containerBackgroundColor" @on-click-content="clickContent" @on-click-dot="clickDot" @on-click-instruction="clickInstruction" @on-click-line="clickLine"></VueHorizontalLine>
</template>

<script>
export default {
  name: 'app',
  components: { 
    VueHorizontalLine: () => { return import('vue-horizontal-line') }
  },
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      containerBackgroundColor: 'rgb(253 252 251)',
      items: [
        {
          instruction: '2020-11-01',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-02',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-03',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-04',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-05',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-06',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-07',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-08',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-09',
          content: '今天除了工作什么都没做,除了bug什么都没写。\n今天除了工作什么都没做,除了bug什么都没写。\n今天除了工作什么都没做,除了bug什么都没写。\n今天除了工作什么都没做,除了bug什么都没写。\n今天除了工作什么都没做,除了bug什么都没写。',
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '今天',
          content: '此处模拟报告漏报\n以此点为中心居中',
          dotColor: '#ed4014',
          lineColor: '#19be6b',
          itemCenter: true
        },
        {
          instruction: '2020-11-11',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-12',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-13',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-14',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        },
        {
          instruction: '2020-11-15',
          content: null,
          dotColor: null,
          lineColor: null,
          itemCenter: false
        }
      ]
    }
  },
  methods: {
    clickContent (item) {
      alert(`点击了【内容】,参数:${JSON.stringify(item)}`)
    },

    clickInstruction (item) {
      alert(`点击了【介绍】,参数:${JSON.stringify(item)}`)
    },

    clickDot (item) {
      alert(`点击了【点】,参数:${JSON.stringify(item)}`)
    },

    clickLine (item) {
      alert(`点击了【线】,参数:${JSON.stringify(item)}`)
    }
  }
}
</script>

API

Props 属性

属性说明类型默认值
items显示的结构化数据Array[]
container-background-color容器背景色String#fff
line-color水平线默认颜色String#e5e6eb

事件 Events

事件名说明返回值
on-click-content内容卡片点击事件当前点击的数据项
on-click-instruction介绍点击事件当前点击的数据项
on-click-dot圆点点击事件当前点击的数据项
on-click-line线段点击事件当前点击的数据项

数据项属性 Items Props

属性说明类型默认值
content卡片展示的内容String
instruction内容卡片对应的说明String
dotColor点的颜色String#2d8cf0
lineColor线段的颜色String#e5e6eb
itemCenter是否以此点为页面的中心。当有多个值为true时以最后一个为准。Booleanfalse
1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago