A beginner of vue.js and I followed this link: /
Almost copy the code into my html.However it just not working.Can someone help me find what is going wrong?
Here are all the codes:
<html>
<body>
<script src=".0.26/vue.min.js">
</script>
<script>
var myModel = {
name: "Ashley",
age: 24
};
var myViewModel = new Vue({
el: '#my_view',
data: myModel
});
</script>
<div id="my_view">
{{ name }}
</div>
</body>
</html>
The result is just:{{name}}
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 me find what is going wrong?
Here are all the codes:
<html>
<body>
<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>
<div id="my_view">
{{ name }}
</div>
</body>
</html>
The result is just:{{name}}
1 Answer
Reset to default 16You 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>
vue.js
is downloaded successfully . – 吴环宇 Commented Jan 20, 2017 at 2:52