I have a very basic Vue.js app that looks like this:
index.html (just the <body>
for succinctness)
<div id="root"></div>
main.js
var config = {
title: 'My App',
}
new Vue({
el: '#root',
template: '<div>{{ config.title }}</div>',
})
This gives me:
Property or method "config" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
(found in root instance)
I'm guessing it's because Vue is looking for it in the data store rather than window
. Is there some way to signal that config
is a global here, or a better way to do this entirely? I suppose I could pass the config object as a prop to my root Vue
instance, but it seems like only components accept props. Thanks for any insights on this.
data : { config : config },
– Luka Jacobowitz Dec 13 '16 at 17:30