[Vue warn]: Unknown custom element

vue.esm.js?efeb:628 [Vue warn]: Unknown custom element:  - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

--->  at src/components/mainPage.vue
        at src/App.vue
         
warn @ vue.esm.js?efeb:628

这个问题已经困扰很久了,小生愚钝一直不知道如何解决,望指点。不胜感激。


  
推荐 关注 热榜
{{item.user_name}} 的提问期待你的解答
未终结
{{item.question_name}}
{{item.question_text}}  查看全文 

写回答
{{item.question_date}}
创作中心

发布问题

发视频
稍后发 存草稿
export default { name: 'mainPage', data () { return { questions: { question_id:'' }, user_id:'', user_name:'', } }, components:{ }, created:function() { console.log('created'); this.getParameter(); this.$nextTick(() => { // 在此处执行你要执行的函数 this.getAllQuestions(); }) }, methods: { getParameter(){ // 将数据放在当前组件的数据内 this.user_id = this.$route.params.user_id; this.user_name=this.$route.params.user_name; }, onOpenChange (openKeys) { const latestOpenKey = openKeys.find(key => this.openKeys.indexOf(key) === -1) if (this.rootSubmenuKeys.indexOf(latestOpenKey) === -1) { this.openKeys = openKeys } else { this.openKeys = latestOpenKey ? [latestOpenKey] : [] } }, //分页获得所有的问题 getAllQuestions () { var _this = this; _this.$axios.post('/api/question/getAllQuestions', _this.$qs.stringify({ }) ).then(function (response) { console.log("打印response.data:"); console.log(response.data) console.log("打印list:"); console.log(response.data.data) _this.questions = response.data.data; console.log("this.questions" + _this.questions) }).catch(function (error) { console.log(error); }); }, onClick ({ key }) { console.log(`Click on item ${key}`) }, onSearch (value) { console.log(value) }, mainPage(){ this.$router.push({name:"mainPage"}) }, publishQuestions(){ console.log(this.user_id,this.user_name); this.$router.push({name:"publishQuestions",params:{user_id:this.user_id,user_name:this.user_name}}) }, getAllAnswers() { var _this = this; _this.$axios.post('/api/answer/getAllAnswers', _this.$qs.stringify({ question_id:_this.questions.question_id }) ).then(function (response) { console.log('打印问题id:') console.log(_this.questions.question_id) }).catch(function (error) { console.log(error); }); }, }, } @import "../assets/index.css";
推荐 关注 热榜
{{item.user_name}} 的提问期待你的解答
未终结
{{item.question_name}}
{{item.question_text}}  查看全文 

写回答
{{item.question_date}}
创作中心

发布问题

发视频
稍后发 存草稿
export default { name: 'mainPage', data () { return { questions: { question_id:'' }, user_id:'', user_name:'', } }, components:{ }, created:function() { console.log('created'); this.getParameter(); this.$nextTick(() => { // 在此处执行你要执行的函数 this.getAllQuestions(); }) }, methods: { getParameter(){ // 将数据放在当前组件的数据内 this.user_id = this.$route.params.user_id; this.user_name=this.$route.params.user_name; }, onOpenChange (openKeys) { const latestOpenKey = openKeys.find(key => this.openKeys.indexOf(key) === -1) if (this.rootSubmenuKeys.indexOf(latestOpenKey) === -1) { this.openKeys = openKeys } else { this.openKeys = latestOpenKey ? [latestOpenKey] : [] } }, //分页获得所有的问题 getAllQuestions () { var _this = this; _this.$axios.post('/api/question/getAllQuestions', _this.$qs.stringify({ }) ).then(function (response) { console.log("打印response.data:"); console.log(response.data) console.log("打印list:"); console.log(response.data.data) _this.questions = response.data.data; console.log("this.questions" + _this.questions) }).catch(function (error) { console.log(error); }); }, onClick ({ key }) { console.log(`Click on item ${key}`) }, onSearch (value) { console.log(value) }, mainPage(){ this.$router.push({name:"mainPage"}) }, publishQuestions(){ console.log(this.user_id,this.user_name); this.$router.push({name:"publishQuestions",params:{user_id:this.user_id,user_name:this.user_name}}) }, getAllAnswers() { var _this = this; _this.$axios.post('/api/answer/getAllAnswers', _this.$qs.stringify({ question_id:_this.questions.question_id }) ).then(function (response) { console.log('打印问题id:') console.log(_this.questions.question_id) }).catch(function (error) { console.log(error); }); }, }, } @import "../assets/index.css";

image.png
如需其他部分的代码,愿意及时奉上。

最佳答案

报错信息不是说的听清楚的吗,有一个的元素,但是并没有发现你有注册,也就是components里并没有注册该组件。你看看你template里的标签,我想你应该是想要h1~6的原生标签吧,看不懂报错信息百度翻译下也行啊