How to pass settings from JS to a component correctly?


I need to pass settings from JS to a component.
It works with the minified VUE version:
but I have an error with regular vue:
What is the correct way?


The problem is that you put your script tag inside VueJS element template. It will cause sideeffects - as the Vue warning says, script tags will not be parsed.

Put your script tag before or after:

<div id="app"></div>

the problem still exists


Did you even tried changing the code? I see the same fiddle where your tag is inside the



The problem is same if I move script tags outside div id=app
The problem is with “TypeError: Cannot read property ‘foo’ of undefined”. It does not appear with the minified vue.


You clearly don’t understand how components and VueJS work.

The template scope is only the Vue instance itself. Global functions and variables need to be proxied to access them.

const settings = {...};

new Vue ({
  data() {
    return {

You cannot insert child component HTML from parent template, you either use slots or have a template HTML separate for the component.