Level 5
Please look at this: https://vuejs.org/v2/guide/migration.html#Two-Way-Filters-replaced
Summer Sale! All accounts are 50% off this week.
In Vue 1 I did:
v-model="item.planned_time | min_to_hours"
In Vue 2 this is not possible... But I'm not sure how to combine the two.
This is my custom filter:
Vue.filter('min_to_hours', {
// model -> view
// formats the value when updating the input element.
read: function(val) {
let nr = val/60;
if (val == 10){ nr = nr.toFixed(2); }
return nr;
},
// view -> model
// formats the value when writing to the data.
write: function(val, oldVal) {
let nr = parseFloat(val)*60;
return nr;
}
});
Please look at this: https://vuejs.org/v2/guide/migration.html#Two-Way-Filters-replaced
Please or to participate in this conversation.