[Vuejs]-Vue.js2 console err is "app.js:2 Uncaught SyntaxError: Unexpected identifier"

0👍

It’s simple. Just change the double quotation marks used in template to single quotation marks.

you can’t include the same quote mark inside the string if it’s being used to contain them

https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Strings

template: "<h1>hello {{ name }}. <button v-on:click="chang">change name</button></h1>",

to

template: "<h1>hello {{ name }}. <button v-on:click='chang'>change name</button></h1>",

jsfiddle that works

Leave a comment