简体   繁体   中英

Not able to update digital clock

I have to display respective time zone in digital format. The clock is displayed but it only updates after refreshing the page. Below is the code I used. Below is my javascript code:

time: function() {
    var zone = _.date.fleetTimeZone();
    return moment().zone(zone).format('h:mm:ss a');
}.property('DS.session.last_fleet_interacted'),

Below is my handlebars:

<div class="time">{{time}}</div>

You'll need to turn time into a property, and update it each second, using setTimeout() or something. Then it'll work because of data binding (I assume Ember.js because tags).

Alternatively, just do a setTimeout() and re-render the time manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM