Reputation: 301
Hi I'm supposed to make a website for school using vue,
I've included vue in the head of the html using:
<script src="https://unpkg.com/vue"></script>
When I try to create a new vue (as a script in html and as a .js file):
var vuetop = new vue({
el: '#vuetop',
data: {
dat: null
},
created: function() {
fetch("/data/topnews.json")
.then(r => r.json())
.then(tdat => {
this.dat = tdat;
})
}
})
I always get the error "Uncaught ReferenceError: vue is not defined"
Upvotes: 1
Views: 2546
Reputation: 554
You can see the oficial vue example in this link (https://gist.githubusercontent.com/chrisvfritz/7f8d7d63000b48493c336e48b3db3e52/raw/ed60c4e5d5c6fec48b0921edaed0cb60be30e87c/index.html)
But maybe only changing vue to Vue like the other answers will solve your problem.
Upvotes: 0
Reputation: 16495
It should be Vue
not vue
, the first letter V
should be an uppercase letter.
Upvotes: 4