{ data: function () { return { time: '' } }, mounted: function () { var timerID = setInterval(this.refresh, 500); }, methods: { refresh: function () { var now = new Date(); this.time = `${now.getHours()}:${now.getMin utes()}:${now.getSeconds()}` } }, ... template: '<div :style=""><h2><slot>時計 </slot></h2>{{ time }}</div>' }) var app = new Vue({ el: "#app" }) </script>