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

vuetify-datetime-all

v0.3.9

Published

一个基于vuetity封装的time组件

Downloads

57

Readme

vuetify-datetime

介绍

vuetify实现element的日期时间组件带校验

下载引入使用

npm i vuetify-datetime-all

import Time from 'vuetify-datetime-all'
import "vuetify-datetime-all/lib/vuetime.css";
Vue.use(Time)

<Time />

参数说明

    <Time type="datetimerange"/>   
    // 时间点datetime或时间段datetimerange

    <Time type="datetimerange" :defaultValue.sync="value"/>    
    // 默认时间 value可为"2022-02-02 00:00:00"也可为new Date()格式,datetimerange状态下传数组格式["2022-02-02 00:00:00","2022-02-08 00:00:00"]

    <Time :defaultTime="['00:00:00','10:00:00']"/>  
    // 默认时间点  datetime传["00:00:00"]即可(placeholder也是["开始时间"])

    <Time type="datetimerange" disabled/>  
    // readonly:只读; editable:主输入框是否可编辑;clearable:是否展示清空按钮;
    
    <Time type="datetimerange" color="#ff0000"/>  
    // 按钮颜色

    <Time type="datetimerange" rangeVal="至"/>  
    // 中间文字

    <Time type="datetimerange" :height="80"/>  
    // 高

    <Time type="datetimerange" :width="500"/>  
    // 宽

    <Time type="datetimerange" :pickerOptions="pickerOptions"/>  
    // 快捷键内容如下

    <Time type="datetimerange" @confirm="confirm"/>  
    // 确认按钮接收默认值时间

    <Time type="datetimerange" :rules="rules" @confirm="confirm"/>  
    // 添加校验rules
    rules:Array<(v:any)=> boolean | string> = [
      (v:any) => !!v[0] || '请选择开始时间',
      (v:any) => !!v[1] || '请选择结束时间',
    ]
    或datetime
    rules:Array<(v:any)=> boolean | string> = [ (v:any) => !!v || '请选择时间' ]

    pickerOptions = 
    [{
      text: '最近一周',
      clickFn:(picker:any):void=>{
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
        picker.datatimeval = [start, end]
      }
    }, {
      text: '最近一个月',
      clickFn:(picker:any):void=>{
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
        picker.datatimeval = [start, end]
      }
    }, {
      text: '最近三个月',
      clickFn:(picker:any):void=>{
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
        picker.datatimeval = [start, end]
      }
    }]
    // [{
    //   text: '今天',
    //   clickFn:(picker:any):void=>{
    //     picker.datatimeval = new Date()
    //   }
    // }, {
    //   text: '昨天',
    //   clickFn:(picker:any):void=>{
    //     const date = new Date();
    //     date.setTime(date.getTime() - 3600 * 1000 * 24);
    //     picker.datatimeval = date
    //   }
    // }, {
    //   text: '一周前',
    //   clickFn:(picker:any):void=>{
    //     const date = new Date();
    //     date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
    //     picker.datatimeval = date
    //   }
    // }]

Customize configuration

See Configuration Reference.