Custom Events Passing Data from Child to Parent
Now that we have a nice modern npm and webpack build, let's tackle getting our components to communicate. In Vue, this is done using custom events. We can emit an event on our child component and then listen for that event on our parent event. Follow along as we code a simple example from scratch.
NPM, Webpack & Single File Component
It's time for us to depart from the compiled CDN of Vue and start compiling our own assets with NPM and Webpack. We will be pulling in Laravel Mix but just for it's Webpack configurations. Finally, we are going to refactor into a Single-File Component.
Vue Components are an integral part of Vue. Come along as we explore our very first Component from scratch. We'll start off with some data and then pass that to our template to render it. Then we'll use a local toggle variable to hide or show the description.
Methods vs. Computed Properties
Let's learn about adding functions or methods to our Vue instances. Then, let's compare them to computed properties and spot the difference.