Home  >  Q&A  >  body text

javascript - Vue is not defined

Developed a project using vue webpack

Vue is not defined is thrown directly when accessing Vue in the browser console

// main.js
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app-box')

How to access the vue instance externally?

滿天的星座滿天的星座2711 days ago1447

reply all(3)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:37:32

    Set a window.xxx = this;

    in created

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-19 10:37:32

    var app = new Vue()

    Isn’t this enough?

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:37:32

    window.app = new vue({});
    This way you can print app in the console

    reply
    0
  • Cancelreply