Bhavya Dhiman
Bhavya Dhiman

Reputation: 237

Vuejs does' nt work using cdn

I am new to VueJS, but something is not working using CDN. I am using a simple example but still doesn't evaluate string interpolation. Here is my code:

HTML

<!DOCTYPE html>
<html>
<head>
    <title>Vue</title>
</head>
<body>
    <div id="app">
       <p>{{ message }}</p>       
    </div>   
    <script src='https://unpkg.com/vue'></script>
    <script src='vue.js'></script>
</body>
</html>

Vuejs

   var app = new Vue({
     e1:'#app',
     data:{
       message:'Hello Vue!'
     }
   })

OUTPUT

It is showing {{message}} instead of Hello Vue!

Is there any solution to this problem?

Upvotes: 1

Views: 3619

Answers (1)

kyun
kyun

Reputation: 10254

var app = new Vue({
  el: '#app', /* NOT e1 */
  data: {
    message: 'Hello Vue!'
  }
})
<div id="app">
  <p>{{ message }}</p>
</div>
<script src='https://unpkg.com/vue'></script>
<script src='vue.js'></script>

You should change e1 to el.

JUST typo...

Upvotes: 1

Related Questions