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"
它应该是Vue
而不是vue
,第一个字母V
应该是一个大写字母。
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.