I've created a Vue.js app using vue-cli
with the webpack-simple template, and it works great. In the provided main.js, I changed the new Vue(...
line to var vm = new Vue(...
, so that I could access the Vue instance from the Chrome Dev Console, but the variable vm
still shows as undefined.
What is the correct way for me to get a reference to the Vue object so that I can do things like manually generating events in components, or manually modifying data from the console?
Try with window.vm = vm;
var vm = new Vue({
el: '#app',
store,
template: '<App/>',
components: { App }
})
window.vm = vm;
And than just type vm
in console. Your Vue object will be available now.
Another option is:
F12
(open dev console) and go to Vue
tabIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With