Time

相对时间组件

Usage

<template>
  <Time :value="time" />
</template>
<script lang="ts">
  import { defineComponent, reactive, toRefs } from 'vue';
  import { Time } from '/@/components/Time';

  export default defineComponent({
    components: { Time },
    setup() {
      const now = new Date().getTime();
      const state = reactive({
        time: now - 60 * 3 * 1000,
      });
      return {
        ...toRefs(state),
        now,
      };
    },
  });
</script>

Props

属性类型默认值可选值说明
valuestring,Date,number--时间值
stepnumber60-刷新时间
modestringrelative-模式,date:日期,datetime:时间戳,relative:相对时间