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

v-time-shaft

v1.0.4

Published

## Project setup ``` yarn install ```

Downloads

15

Readme

时间轴

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

Document

See 详细使用文档.

说明

属性

timeSegmentsData 时间范围片段数据,类型:Array[object]

// 基本结构如下:
[{
  id,
  beginTime,          // 片段开始时间,时间戳,单位毫秒
  finishTime,         // 片段结束时间,时间戳,单位毫秒
  active,             // 是否选中状态
  lineWidth,          // 片段边框的线宽
  y,                  // 片段在canvas上距离顶部距离
  h,                  // 片段在canvas上的高度
  bgColor,            // 片段背景颜色
  borderColor,        // 片段边框颜色
  bgColorActive,      // 片段选中状态背景颜色
  borderColorActive,  // 片段选中状态边框颜色
  ...
}]

gridStyles 时间刻度样式 Object

// 支持属性:
{
  lineColor,  // 刻度线条颜色
  lineWidth,  // 刻度线条宽度
  lineHeight  // 刻度线条高度
  color,      // 刻度上时间的文字颜色
  dateColor,  // 刻度上的日期文字颜色
  bgColor,    // 刻度条背景颜色
  bgHeight,   // 刻度条背景高度
}

hoverStyles 鼠标滑过的时间指示器 Object

// 支持属性:
{
  lineColor,  // 刻度线条颜色
  lineWidth,  // 刻度线条宽度
  lineHeight  // 刻度线条高度
  color,      // 刻度上时间的文字颜色
}

isLimit 是否限制时间范围 Boolean

  • 该属性必须与 dateRange 配合

dateRange 限制时间范围 Array[string]

  • 该属性必须与 isLimit 配合
  • 时间范围的日期不能与date冲突, 如:date是2024-5-31, 时间范围的日期必须是在31日内的时间
  • 时间范围格式:"YYYY-MM-DD HH:mm:ss"
  • 例如:['2024-5-31 00:00:00', '2024-5-31 23:59:59']

date 用于确定时间轴展示哪一天 String

  • 该属性不能携带时间:"YYYY-MM-DD"
  • 时间范围的日期不能与date冲突, 如:date是2024-5-31, 时间范围的日期必须是在31日内的时

可以去npm直接下载插件

  • 下载插件
    yarn add v-time-shaft
  • 全局引入
    import TimerShaft from '../node_modules/v-time-shaft/lib/v-time-shaft.umd'
    ......
    Vue.use(TimerShaft)
  • 组件中使用
    <template>
      <div id="app">
        <div class="timer-shaft-content">
          <!-- 不限制时间范围,只初始化默认展示哪天的时间 -->
          <v-time-shaft date="2024-05-29"></v-time-shaft>
        </div>
        <div class="timer-shaft-content">
          <!-- 限制时间范围的有用法 -->
          <v-time-shaft isLimit :date="date" :dateRange="dateRange"></v-time-shaft>
        </div>
      </div>
    </template>

效果图:

  • 成品效果图 在这里插入图片描述
  • 放大后,查看时间片段在这里插入图片描述
  • 不限制范围拖动到前一天在这里插入图片描述
  • 时间指示器【鼠标移入,产生的蓝色线条和时间点】在这里插入图片描述