We should add a couple more features to make our list of stories neat. We can give the user the ability to change the plot and the writer of a story and create new stories.
Let's start with the first task and give the user some inputs to manipulate the story's attributes. Two bound inputs should do the job, but we should display them only when the user is editing a story. It seems like the kind of work we did in previous chapters.
To define if story
is in edit state we will use a property, editing
, which will become true
when the user hits the Edit
button:
<td> <!--if editing story display the input for plot--> <input v-if="story.editing" v-model="story.plot" class="form- control"> </input> <!--in other occasions show the story plot--> <span v-else> {{story.plot}} </span> </td> <td> <!-- if editing story...