【发布时间】:2020-12-03 10:12:02
【问题描述】:
我有一个简单的单文件组件,名为“MobileApps.vue”:
<template>
<div class="grey-bg about-page">
<p>{{ greetings }}</p>
</div>
</template>
<script>
export default {
name: 'Home',
data() {
return {
greetings: "Hello"
}
}
};
</script>
并注册它:
const app = new Vue({
el: '#app',
router,
components: {
Home,
About,
Gas,
Electricity,
Contacts,
Electricity_info,
Gas_info,
MobileApps
},
data: {
},
created() {
},
destroyed() {
},
mounted() {
let mySVGsToInject = document.querySelectorAll('img.inject-me');
SVGInjector(mySVGsToInject);
},
methods: {
}
});
当我尝试使用 <MobileApps> 组件打开 HTML 文件时,我会收到错误消息:
vue.esm.js:628 [Vue 警告]:未知的自定义元素:- 您是否正确注册了组件?对于递归组件,请确保提供“名称”选项。
但即使我提供了一个名字,也没有任何反应。
【问题讨论】:
-
这能回答你的问题吗? Vue component name must be lowercase?
-
@underscore_d nope.
-
很奇怪,因为据我所知,您接受的答案表明您有相同的根本原因。
-
@underscore_d 对不起,我的错。你的权利。
标签: javascript html vue.js vuejs2 vue-component