Giter Site home page Giter Site logo

vue-date-format's Introduction

vue-date-format

Date format component for Vue2.0 | DEMO

日期格式化、美化插件

Installation

# npm
npm install vue-date-format

# yarn
yarn add vue-date-format

Import

// main.js

import vueDateFormat from 'vue-date-format'
Vue.use(vueDateFormat)

Usage

In template

<vueDateFormat :format="format" :time="time" :type="type" :autoUpdate="autoUpdate"></vueDateFormat>

Set config value

data () {
    return {
        format:'yyyy年MM月dd日 hh:mm:ss',
        time:new Date(), //时间或字符串(eg:'2017-12-12'),
        type:'fmt',
        autoUpdate:false
    }
}
参数 说明 类型 可选值 默认值
format 格式化 String - 'yyyy-MM-dd hh:mm:ss'
time 需要展示的时间 Date/String Date或时间字符串,不传默认为当前时间 new Date()
type 类型(格式化/多久以前) String 'fmt'/'ago' 'fmt'
autoUpdate 是否自动更新时间;type为‘fmt’时,开启自动更新,会忽略传入的time值,自动展示系统时间 Boolean true/false false
autoTime 自动更新间隔时间(autoUpdate为false设置无效果) Number 正整数,单位为秒(s) 30

vue-date-format's People

Contributors

slimcheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.