Vue.js - Property Or Method "blah" Is Not Defined On The Instance But Referenced During Render
Why does Vue 2 throw an error that a prop is not defined when it is statically defined in the parent template? Note: This error is not thrown if I bring the javascript inside the .
Solution 1:
Hypothesis:
When importing the loader.js
file using the src="./loader.js"
in the .vue
file's markup the error in the initial question is thrown. This instance of the component object might be being shared between every instance of the loader component, some of which have the embedded
prop passed in and some that don't. This could open the door to other calls to the <loader />
constructor over writing the prop's value on instantiation.
Answer :
Switching to an import and export inside the script tag fixes the error:
loader.vue
<templatesrc="./loader.html" /><scriptlang="babel">import loader from'./loader';
exportdefault loader;
</script><stylesrc="./loader.scss"lang="scss"scoped />
Post a Comment for "Vue.js - Property Or Method "blah" Is Not Defined On The Instance But Referenced During Render"