4. Nesting Components (Modularity)
Activity 4.01: A Local Message View with Reusable Components
Solution:
Perform the following steps to complete the activity.
Note
To access the code files for this activity, refer to https://packt.live/36ZxyH8.
First, we need a way to capture messages from the user:
- Create a
MessageEditorcomponent that displays atextarea:<template> Â Â <div> Â Â Â Â <textarea></textarea> Â Â </div> </template>
- Adding a reactive instance property can be done using the
datacomponent method:<script> export default {   data() {     return {       message: ''     }   } } </script> - On
changeoftextarea, we will store the state in amessagereactive instance variable that we have set to null in thedatacomponent method:<template> Â Â <!...