Skip to content Skip to sidebar Skip to footer

Simple Html With Vue.js Not Working

A beginner of vue.js and I followed this link: https://www.sitepoint.com/getting-started-with-vue-js/ Almost copy the code into my html.However it just not working.Can someone help

Solution 1:

You need to add the <head> tag and add the script at the end of the file like this:

<html>
<head>
<title></title>
</head>
<body>
<div id="my_view">
{{ name }} {{ age }}
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script>

<script>

var myModel = {
  name: "Ashley",
  age: 24
};

var myViewModel = new Vue({
  el: '#my_view',
  data: myModel
});

</script>

</body>
</html>

Post a Comment for "Simple Html With Vue.js Not Working"