问题描述
我有一个简单的单文件组件,名为“ 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警告]:未知的自定义元素:-您是否正确注册了组件?对于递归组件,请确保提供“名称”选项。
但是即使我提供了名字,也没有任何反应。
解决方法
尝试使用result
这样的cabeb-case格式:
<mobile-apps>