npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

timeline-slider-vue

v1.1.0

Published

timeline-slider-vue

Downloads

17

Readme

带拖动和播放功能的时间轴

timeline-slider-vue

Demo

Github

Install

npm install --save timeline-slider-vue

Usage

main.js

import TimelineSliderVue from 'timeline-slider-vue'
import 'timeline-slider-vue/lib/timeline-slider-vue.css'
Vue.use(TimelineSliderVue)

```vue
    <TimelineSliderVue
      :date="date"
      :mask="mask"
      :mark-date="markDate"
      :lock-date="lockDate"
      :play="play"
      :play-speed="playSpeed"
      @change="handleChange"
      @input="handleInput">
      <div
        slot="sliderContent"
        slot-scope="scope">
        {{ scope.data }}
      </div>
    </TimelineSliderVue>

使用示例

<template>
	<div id="app">
		<TimelineSliderVue
			:date="date"
			:mask="mask"
			:mark-date="markDate"
			:lock-date="lockDate"
			:play="play"
			:play-speed="playSpeed"
			@change="handleChange"
			@input="handleInput"
		>
			<div slot="sliderContent" slot-scope="scope">
				{{ scope.data }}
			</div>
		</TimelineSliderVue>
	</div>
</template>

<script>
export default {
	data() {
		return {
			playSpeed: 1000, // 播放速度
			play: false, // 自动播放
			lockFlag: false,
			markFlag: false,
			lockDate: [], // 锁定的日期(滑动结束时自动跳到指定的日期)
			markDate: [], // 做标记的日期
			mask: true,
			date: '2022-06-01',
		}
	},
	methods: {
		handleInput(date, value) {
			console.log('input', date, value)
		},
		handleChange(date, value) {
			console.log('change', date, value)
		},
	},
}
</script>

竖向模式

    <TimelineSliderVue
      vertical
      height="240px"
      :max-value="100"
      :min-value="0"
      :init-value="40"
      @change="handleChange"
      @input="handleInput"
    >
      <div slot="sliderContent" slot-scope="scope">
        <div>{{ scope.value }}</div>
      </div>
    </TimelineSliderVue>

Available props

| 参数 | 类型 | 默认值 | 说明 | | :-------- | :------: | :--------- | :------------------------------------------------------------------------------------------------------------------------------------ | | vertical | Boolean | false | 竖向模式(只有滑块功能样式,没有日期等功能) | | initValue | Number | 0 | v-model 绑定的初始值(仅在 vertical = true 时生效) | | minValue | Number | 0 | 最小值(仅在 vertical = true 时生效) | | maxValue | Number | 100 | 最大值(仅在 vertical = true 时生效) | | date | String | 当日 | yyyy-MM-dd 格式的日期,根据传入的日期,设置滑块的位置 | | mask | Boolean | true | 拖动过程中是否显示遮罩层 | | mark-date | Array | [] | 一些特殊日期标注,例如 ['2022-03-08', '2022-06-18', '2022-11-11'] | | lock-date | Array | [] | 锁定的日期,只能在指定日期下切换,当滑块拖动到其他位置,自动跳到离指定日期最近的日期处例如 ['2022-03-08', '2022-06-18', '2022-11-11'] | | play | Boolean | false | 播放 | | playSpeed | Number | 1000 | 播放速度,同 setInterval milliseconds 参数 |

slot

| 参数 | 说明 | | :------------ | :------: | | sliderContent | 滑块内容 |

Events

| 事件名称 | 说明 | 回调参数 | | :----------- | :------------------------------------------------: | :----------- | | change | 值改变时触发(使用鼠标拖拽时,只在松开鼠标后触发) | 改变后的值 | | input | 数据改变时触发(使用鼠标拖拽时,活动过程实时触发) | 改变后的值 |

Project setup


yarn install

Compiles and hot-reloads for development


yarn serve

Compiles and minifies for production


yarn build

Lints and fixes files


yarn lint