0.1.4 • Published 4 years ago

vue-time v0.1.4

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

vue-time

vue2 npm download unpkg

Display current time. Demo (Once Per Second)

In fact, it is just a practice about how to build a lib.

If you want to handle time, you can use dayjs or moment .

How to use

npm install vue-time

Dev

Install

npm install

Example

<template>
  <div>
    <vue-time :show-date="showDate" :show-day="showDay" :show-time="showTime"></vue-time>
  </div>
</template>
import 'vue-time';
export default {
  components: { vueTime },
  data () {
    return {
      showDate: false,
      showDay: true,
      showTime: true,
      locales: 'zh-CN',
      options: {
        hour12: false,
        timeZone: 'Asia/Shanghai',
        era: 'long',
        weekday: 'long',
        year: 'numeric',
        month: 'numeric',
        day: 'numeric'
      }
    }
  }
}

Display

公元2019年1月28日星期一 19:55:13

Options

AttributeDescriptionTypeOptionsDefault
show-date显示年份日期Boolean——true
show-day显示星期几Boolean——true
show-time显示时间Boolean——true
locales区域String-'zh-CN'
options设置Object-

You can see more info about locales & options from DateTimeFormat - MDN.

AttributeDescriptionTypeDefault
hour1212小时制Booleanfalse
timeZone时区String'Asia/Shanghai'
era公元String'long'
weekday星期几String'long' (short:周几)
year年份String'numeric'
month月份String'numeric'
day星期几String'numeric'
0.1.4

4 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.6

5 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago