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.vuefile in thesrc/views/folder as the main component to interact with the user when writing a message. We usetextareaas a message input field and attach thelistenermethodonChangeto theDOMevent change to capture any input change regarding the message typed by the user. Also, we addrefto keep a pointer record to the rendered HTMLtextareaelement for modifying our saved messages at a later stage.Besides this, we also attach another
listenermethod,onSendClick, to theclickevent on theSubmit buttonto capture the user's confirmation for sending the message. The actual logic implementation of bothonChangeandonSendClickis shown in Step 3. - The
<template>section should...