請問這段代碼為什么執(zhí)行后瀏覽器里面只顯示{{msg}}?
<!DOCTYPE?html><html?lang="en"><head>????<meta?charset="UTF-8">????<meta?name="viewport"?content="width=device-width,?initial-scale=1.0">????<title>Document</title>????<script?src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.0-beta.15/vue.cjs.js"></script></head><body>????<div?id="app">????????{{msg}}????</div>????<script>????????new?Vue({????????????el:'#app',????????????data:{????????????????msg?:?'hello?Vue!'????????????}????????})????</script></body></html>
2020-08-20
樓上正解,3.0的語法已經(jīng)發(fā)生了變化。不能new vue了,需要使用createApp:https://v3.vuejs.org/guide/introduction.html#declarative-rendering
2020-12-20
引入cdn需要3.0以下,3.0不能這樣了
2020-07-28
測試了一下,是你的https://cdn.bootcdn.net/ajax/libs/vue/3.0.0-beta.15/vue.cjs.js有問題。
我記得老師說過不要選有beta的,不穩(wěn)定。
2020-06-26
<!DOCTYPE?html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
????<meta?name="viewport"?content="width=device-width,?initial-scale=1.0">
????<title>Document</title>
????<script?src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.0-beta.15/vue.cjs.js"></script>
</head>
<body>
????<div?id="app">
????????{{msg}}
????</div>
????<script>
????????new?Vue({
????????????el:'#app',
????????????data:{
????????????????msg?:?'hello?Vue!'
????????????}
????????})
????</script>
</body>
</html>