1

I have a django model which stores created and updated date on my front end i have a header called Date in my vue headers i am displaying the created date but i need to display the updated date under the same header when an object is updated. i have same date called row.updated_date_formatted if this is none i need to display created_date else i need to display updated date

 <template slot="row" slot-scope="{ row, index }">
   <td v-text="row.created_date_formatted"> </td>
  </template>
Happy
  • 29
  • 1
  • 5
  • 1
    [`slot-scope` is deprecated](https://stackoverflow.com/a/74053245/8816585) for quite some time already. What did you tried/is not working so far? – kissu Nov 03 '22 at 09:37

1 Answers1

0

You can code your logic right in v-text parameter value with Vue. Something like this:

<td v-text="row.updated_date_formatted != null ? row.updated_date_formatted : row.created_date_formatted"></td>

Or the same with Mustache syntax:

<td>{{row.updated_date_formatted != null ? row.updated_date_formatted : row.created_date_formatted}}</td>

v-if v-else is not really necessary in this case.

Tolbxela
  • 4,767
  • 3
  • 21
  • 42