![](/img/trans.png)
[英]Error: vue.js:634 [Vue warn]: Property or method "item" is not defined on the instance but referenced during render
[英]When I add the data object 'job', the error : vue.js:634 [Vue warn]: Property or method "job" is not defined on the instance
为什么当我添加一些数据对象'job'时,vue是错误的....我该怎么办? 像这样的代码
应用程序.js:
new Vue({
el: '#vue-app',
data: {
name: 'My Name',
job: 'My Job',
age: 'My Age'
}
})
索引.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>VueJS Practice</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="vue-app">
<p>{{ name }}</p>
<p>{{ job }}</p>
<p>{{ age }}</p>
</div>
<script src="app.js"></script>
</body>
</html>
数据需要返回一个对象
new Vue({
el: '#vue-app',
data: function () {
return {
name: 'My Name',
job: 'My Job',
age: 'My Age'
};
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.