Is it possible to evaluate the v-if directive only once on an element and ignore any changes in the boolean expression after that? For example:
<div v-for="item in items" v-bind:key="item.id">
<span>{{ item.name }}</span>
<span>{{ item.status }}</span>
<span v-if="match.lastUpdateEpoch">Last Changed {{ getDateFromEpoch(match.lastUpdateEpoch) }}</span>
</div>
I only want the third and final span to be displayed if the value is non-zero when the items are initially loaded and rendered but I only want the v-if expression to be evaluated once. So, if the value of match.lastUpdateEpoch is initially 0, it won't be displayed. But if the value changes to something non-zero at any stage, I still don't want it to be displayed. It should only respect the first evaluation. Is this possible using a directive or something else that doesn't involve me creating additional state variables? I am aware of v-once but that only means the value itself will not be re-rendered when it is updated, the show/hide expression will still be evaluated.
The items are initially set based on some JSON data returned from my server e.g.
var VUE = new Vue({
el: '#vue-root',
data: {
items: [],
...
...
var items = loadItems(); // ajax server call
VUE.items = items;
// each item is an object e.g.
// {name:'a',status:'1',lastUpdateEpoch: 0}
// {name:'b',status:'2',lastUpdateEpoch: 123456789}