What I am trying to achieve is a component that deals conditionally with new input or old input(edit). I've tried this, inspired by this question:
<input type="text" placeholder="New Event" v-model="event.title ? event.title : title" required/>
or even
<input type="text" placeholder="New Event" v-model="event.title || title" required/>
but both don't work. I get errors in the console.
event.title
comes from prop event
;
title
is a property in the data object with the value of ''
.
In Vue 2 do I need to build 2 separate components? One for new input and another for editing?