【发布时间】:2022-01-18 06:38:33
【问题描述】:
我写了hello world vue js 3 simple Programme。然后它给出以下错误。我想将 vue 属性值传递给 HTML 值。但它不起作用。请帮我解决这个问题。
package.json
{
"name": "myfirstproject",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"vite": "^2.7.2",
"vue": "^2.6.14"
}
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
<h1>Hello world {{msg}}</h1>
</div>
<script type="module">
import { createApp } from 'vue/dist/vue.esm.browser'
const app = createApp({
data(){
return {
msg: "Sri Lanka"
}
},
}).mount('#app');
</script>
</body>
</html>
【问题讨论】: