1
0

clock.vue 461 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <div>{{ dtstr }}</div>
  3. </template>
  4. <style>
  5. code {
  6. white-space: pre-wrap !important;
  7. }
  8. </style>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. dtstr: "boo",
  14. };
  15. },
  16. mounted: function () {
  17. this.startTime();
  18. },
  19. methods: {
  20. startTime: function () {
  21. this.dtstr = new Date().toLocaleTimeString();
  22. setTimeout(this.startTime, 1000);
  23. },
  24. },
  25. };
  26. </script>