1

In my root component (app.js), I have data, activeTab, that I want to pass down to Topbar. How do I do this from within the app.js file I have here?

app.js

window.Vue = require('vue');


Vue.component('Topbar', require('./components/Topbar.vue').default);


new Vue({
    el: "#app",
    data: {
        activeTab: "cart"
    },
    methods: {
        handleTabChange: function(tab) {
           this.activeTab = tab
        }
    }
})
jjoan
  • 383
  • 1
  • 3
  • 17
  • Is there a top-level template that you're not showing us? – WW. Mar 11 '19 at 05:03
  • @WW. there is a blade file (php view) where I have:
    – jjoan Mar 11 '19 at 05:14
  • Possible duplicate of [Pass data from parent to child component in vue.js](https://stackoverflow.com/questions/39199303/pass-data-from-parent-to-child-component-in-vue-js) – Thanthu Mar 11 '19 at 05:22

1 Answers1

0

props are what you need to pass down data. see here

tony19
  • 125,647
  • 18
  • 229
  • 307
exloser
  • 37
  • 1
  • 7