1

Here is my code and i seem to have done everything correctly. what might be the problem as the output is only {{message}}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<div id="app">
<h1>{{message}}</h1>
</div>

<script src="https://vuejs.org/js/vue.js"/>
<script>
    new Vue({
        el: '#app',
        data:{
            message: "Yow"
        },
        mounted: function () {
            console.log("Mounted")
        }
    });
</script>
</body>
</html>

and it just outputs {{message}}

Makamu Evans
  • 491
  • 1
  • 10
  • 25

1 Answers1

2

Hey man you forgot to close ending script tag in vue.js script/api

You were rendering whole html part in script tag like you can see in console below : enter image description here

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

<div id="app">
<h1>{{message}}</h1>
</div>
<script src="https://vuejs.org/js/vue.js"/>
</script>
<script>
    console.log('hi');
    var app = new Vue({
        el: '#app',
        data:{
            message: 'yow'
        },
        mounted: function () {
            console.log("Mounted")
        }
    });
</script>
</body>

And always inlude api/main/cdn link ahead of any operational js file

Meet Zaveri
  • 2,921
  • 1
  • 22
  • 33