In this part, we will create the <template> section of the single file component. Follow these steps to create it:
- At the top of the template, we need to add the response property, wrapped in an <pre> HTML element:
<h3>Response</h3>
<pre>{{ response }}</pre>
- For the creation and updating of a user, we need to create a textarea HTML input with a v-model directive bound to the userData property:
<hr/>
<h1> Create / Update User </h1>
<label for="userData">
User JSON:
<textarea
id="userData"
v-model="userData"
rows="10"
cols="40"
style="display: block;"
></textarea>
</label>
- To send this data, we need to create two buttons, both having an event listener bound on the click event with the @click directive targeting the createUser and updateUser respectively, and passing the userData in the execution:
<button...