我正在尝试找出 Vue.js,但在创建组件时遇到了麻烦。我不明白什么是错的,什么是缺失的,但我仍然发现错误:
[Vue warn]: Unknown custom element: <mytag> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in <Root>)
索引.html:
<!DOCTYPE html>
<html>
<head>
<title>vueTest</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--<div class="app">-->
<!-- <h2>{{ product }}</h2>-->
<!-- <img :src="path " width="50px" height="50px" class="theIMG" :style="styless">-->
<!--</div>-->
<div id="anAp">
<myTag></myTag>
</div>
<!--<button id="theButton">Press</button>-->
<script src="vue.js"></script>
<script src="action.js"></script>
</body>
</html>
动作.js:
Vue.component ("myTag",{
name: 'myTag',
template: '<p>Hello world!</p>'
})
new Vue({
el: '#anAp',
data: {
}
})
请帮我修复它,我是 Vue.js 的新手((
报错说
mytag
没有找到同名的组件,这意味着你需要处理Vue
.引用官方指南 -组件命名:
其他建议
和工作示例: