useTimestamp

useTimestamp

リアクティブな現在のタイムスタンプ

使用法

import { useTimestamp } from '@vueuse/core'

const timestamp = useTimestamp({ offset: 0 })
import { useTimestamp } from '@vueuse/core'
// ---cut---
const { timestamp, pause, resume } = useTimestamp({ controls: true })

コンポーネントでの使用法

<template>
  <UseTimestamp v-slot="{ timestamp, pause, resume }">
    現在の時間: {{ timestamp }}
    <button @click="pause()">
      一時停止
    </button>
    <button @click="resume()">
      再開
    </button>
  </UseTimestamp>
</template>