So what is the difference if I use window.app in main.js in Vue instead of const app?
import question from './components/Questions.vue';
Vue.http.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
window.App = new Vue({
el: '#app',
components: { question }
});
instead of
import question from './components/Questions.vue';
Vue.http.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
const app = new Vue({
el: '#app',
components: { question }
});
So the reason I used window.app because I want to call a method from question component using an external jQuery function to execute the Vue method, like App.component.metho() then it works. But is this safe approach?