6. Routing
Activity 6.01: Creating a Message SPA with Dynamic, Nested Routing, and Layouts
Solution:
Perform the following steps to complete the activity:
Note
To access the code files for this activity, refer to https://packt.live/2ISxml7.
- Create a new
MessageEditor.vue
file in thesrc/views/
folder as the main component to interact with the user when writing a message. We usetextarea
as a message input field and attach thelistener
methodonChange
to theDOM
event change to capture any input change regarding the message typed by the user. Also, we addref
to keep a pointer record to the rendered HTMLtextarea
element for modifying our saved messages at a later stage.Besides this, we also attach another
listener
method,onSendClick
, to theclick
event on theSubmit button
to capture the user's confirmation for sending the message. The actual logic implementation of bothonChange
andonSendClick
is shown in Step 3. - The
<template>
section should...