Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

willbrowning's avatar

Accessing the spark vue instance

This might be a silly question but how can I access the spark vue instance created in app.js?

For example in my app.js file I create a vue intstance:

var app = new Vue({
    mixins: [require('spark')]
});

From examples I've seen online I should be able to type "app" in the console to access the Vue methods and data however I get the error:

VM37764:1 Uncaught ReferenceError: app is not defined(…)

I'm using vue-router and looking for a way to access the data/methods in a .vue component file but cannot find any answer online.

Does anyone know how I could go about this?

0 likes
2 replies
thomaskim's avatar
Level 41

@tttwb Try this instead:

window.app = new Vue({
    mixins: [require('spark')]
});
1 like
willbrowning's avatar

@thomaskim Thank you, that works perfectly.

I can now access the data I need via

app.$children[1]._data

Is there any security risk of having all this data available and accessible?

Also what is the point of having var app = new Vue({... if it cannot be accessed?

Please or to participate in this conversation.