[Vue warn]: Unknown custom element

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

found in

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

這個問題已經(jīng)困擾很久了,小生愚鈍一直不知道如何解決,望指點。不勝感激。

<template>
  <div id="mainPage" style="height:100%;width:100%">
    <a-layout id="components-layout-demo-top-side-2">
    <div id="header">
      <div class="logo">知&nbsp;否</div>

      <div id="title" @click="mainPage">
        <a-icon type="home" />&nbsp;首頁
        <a-icon type="user" />&nbsp;個人中心
      </div>
        <input
            placeholder="input search text"
            size="large"
            @search="onSearch"
       >
        <button type="button" id="search" @click="onSearch" style="
    height: 15px;
    width: 80px;
    margin: 10px;
    padding: 18px;
    border-radius: 10px;
    line-height: 0px;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 20px;
    color:white;
    position: absolute;
    background: deepskyblue;
    font-weight: bold;
    color: lightblue;



    transform: translateY(4px);
">提問</button>
      <div style="height:60px;weight:200px;float:right;padding: 0 20px;">
        <div id="right" style="padding: 20px 5px 10px 20px;">
        <a-icon type="bell"/>&nbsp;通知
        </div>
<!--        <div style="display: inline-block">
          ![](../assets/logo.png)
        </div>-->
        <template>
          <a-dropdown>
            <a style="color:white;font-size:15px" >
              {{ user_name }} <a-icon type="down" style="color:white;font-size:20px" />
            </a>
            <a-menu slot="overlay" @click="onClick">
              <a-menu-item key="1">
                <a-icon type="setting" />
                設(shè)置
              </a-menu-item>
              <a-menu-item key="2">
                <a-icon type="logout" />
                退出
              </a-menu-item>

            </a-menu>
          </a-dropdown>
        </template>

      </div>
    </div>

      <a-layout style="height:520px">

        <a-layout style="padding: 0 24px 24px">
          <a-breadcrumb style="margin: 16px 0">

          </a-breadcrumb>
          <a-layout-content
              :style="{ background: '#fff', padding: '14px', margin: 0, minHeight: '280px',width: '900px' }"
          >
            <div id="container_header">
              <a-menu mode="horizontal">
                <a-menu-item>推薦 </a-menu-item>
                <a-menu-item>關(guān)注</a-menu-item>
                <a-menu-item>熱榜</a-menu-item>
              </a-menu>
            </div>
              <div id="question_block" v-for="item in questions">
                <h style="font-size: 15px" >{{item.user_name}}&nbsp;的提問期待你的解答</h><br/>
                <div style="float:right;background: red;font-size: 18px;padding:5px;color:white">未終結(jié)</div>
                <h id="question_title" style="font-size:20px;font-weight: bold">{{item.question_name}}</h><br/>
                <a @click="getAllAnswers">{{item.question_text}}&nbsp;&nbsp;查看全文&nbsp;<a-icon type="down" /></a><br/><br/>
                <a-button style="background: lightskyblue"><a-icon type="edit" />寫回答</a-button>
                <div style="font-size: 14px;float:right;display:inline-block">{{item.question_date}}</div>
<!--                :{{item.question_shield_state}}:{{item.question_end_State}}:-->


              </div>

          </a-layout-content>
          <div id="side_card">
            <div
                style="height: 30px;
                      width: 100%;
                      text-align: center;
                      padding: 10px 0;
                      font-size: 20px;">
              創(chuàng)作中心
            </div>
            <a-divider style="margin:17px 0 13px 0;"/>

            <div style="height:80px;width:100%">
            <div style="height: 80px;width: 150px;padding: 0 0 0 20px;">
            <div style="height: 80px;
                  width: 100px;
                  text-align: center;
                  font-size: 20px;" @click="publishQuestions">
              <a-icon type="edit" style="fontSize:20px;padding: 0 0 10px 0"/><br/>
              發(fā)布問題
            </div>
            </div>

            <div style="position:absolute;
            display:inline-block;
            left: 150px;
            right: 0px;
            top: 60px;
            height: 80px;
            width: 10px;">
              <div style="height: 80px;
                  width: 100px;
                  text-align: center;
                  font-size: 20px;">
                <a-icon type="video-camera" style="fontSize:20px;padding: 0 0 10px 0"/><br/>
                發(fā)視頻
              </div>
            </div>

            </div>
            <a-divider style="margin:17px 0 13px 0;"/>

            <a-row>
              <a-col :span="12" style="padding: 10px 0px;font-size: 20px;">
                稍后發(fā)
              </a-col>
              <a-divider type="vertical" style="height: 50px; position: absolute;right: 125px;"/>
              <a-col :span="12" style="padding: 10px 0px;font-size: 20px;">
                存草稿
              </a-col>
            </a-row>

          </div>
        </a-layout>

      </a-layout>
      </a-layout>

  </div>

</template>

<!--import { Divider } from 'antd';-->
<script>

export default {
  name: 'mainPage',
  data () {
    return {
      questions: {
          question_id:''
      },
      user_id:'',
      user_name:'',

    }
  },
  components:{

  },
  created:function() {
    console.log('created');
    this.getParameter();
    this.$nextTick(() => {
      // 在此處執(zhí)行你要執(zhí)行的函數(shù)
      this.getAllQuestions();

    })
  },
  methods: {
    getParameter(){
      // 將數(shù)據(jù)放在當(dāng)前組件的數(shù)據(jù)內(nèi)
      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);

      });
    },


  },



}
</script>

<style scoped>
@import "../assets/index.css";
</style>
<template>
  <div id="mainPage" style="height:100%;width:100%">
    <a-layout id="components-layout-demo-top-side-2">
    <div id="header">
      <div class="logo">知&nbsp;否</div>
      <div id="title" @click="mainPage">
        <a-icon type="home" />&nbsp;首頁
 <a-icon type="user" />&nbsp;個人中心
 </div>
        <input
 placeholder="input search text"
 size="large"
 @search="onSearch"
 >
        <button type="button" id="search" @click="onSearch" style="
 height: 15px;
    width: 80px;
    margin: 10px;
    padding: 18px;
    border-radius: 10px;
    line-height: 0px;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 20px;
    color:white;
    position: absolute;
    background: deepskyblue;
    font-weight: bold;
    color: lightblue;
    transform: translateY(4px);
">提問</button>
      <div style="height:60px;weight:200px;float:right;padding: 0 20px;">
        <div id="right" style="padding: 20px 5px 10px 20px;">
        <a-icon type="bell"/>&nbsp;通知
 </div>
<!--        <div style="display: inline-block">
 <img alt="Vue logo" src="../assets/logo.png" style="width:50px;height:50px;padding: 0 0 10px 10px;"> </div>--> <template>
          <a-dropdown>
            <a style="color:white;font-size:15px" >
              {{ user_name }} <a-icon type="down" style="color:white;font-size:20px" />
            </a>
            <a-menu slot="overlay" @click="onClick">
              <a-menu-item key="1">
                <a-icon type="setting" />
                設(shè)置
 </a-menu-item>
              <a-menu-item key="2">
                <a-icon type="logout" />
                退出
 </a-menu-item>
            </a-menu>
          </a-dropdown>
        </template>
      </div>
    </div>
      <a-layout style="height:520px">
        <a-layout style="padding: 0 24px 24px">
          <a-breadcrumb style="margin: 16px 0">
          </a-breadcrumb>
          <a-layout-content
 :style="{ background: '#fff', padding: '14px', margin: 0, minHeight: '280px',width: '900px' }"
 >
            <div id="container_header">
              <a-menu mode="horizontal">
                <a-menu-item>推薦 </a-menu-item>
                <a-menu-item>關(guān)注</a-menu-item>
                <a-menu-item>熱榜</a-menu-item>
              </a-menu>
            </div>
              <div id="question_block" v-for="item in questions">
                <h style="font-size: 15px" >{{item.user_name}}&nbsp;的提問期待你的解答</h><br/>
                <div style="float:right;background: red;font-size: 18px;padding:5px;color:white">未終結(jié)</div>
                <h id="question_title" style="font-size:20px;font-weight: bold">{{item.question_name}}</h><br/>
                <a @click="getAllAnswers">{{item.question_text}}&nbsp;&nbsp;查看全文&nbsp;<a-icon type="down" /></a><br/><br/>
                <a-button style="background: lightskyblue"><a-icon type="edit" />寫回答</a-button>
                <div style="font-size: 14px;float:right;display:inline-block">{{item.question_date}}</div>
<!--                :{{item.question_shield_state}}:{{item.question_end_State}}:-->
 </div>
          </a-layout-content>
          <div id="side_card">
            <div
 style="height: 30px;
                      width: 100%;
                      text-align: center;
                      padding: 10px 0;
                      font-size: 20px;">
              創(chuàng)作中心
 </div>
            <a-divider style="margin:17px 0 13px 0;"/>
            <div style="height:80px;width:100%">
            <div style="height: 80px;width: 150px;padding: 0 0 0 20px;">
            <div style="height: 80px;
                  width: 100px;
                  text-align: center;
                  font-size: 20px;" @click="publishQuestions">
              <a-icon type="edit" style="fontSize:20px;padding: 0 0 10px 0"/><br/>
              發(fā)布問題
 </div>
            </div>
            <div style="position:absolute;
            display:inline-block;
            left: 150px;
            right: 0px;
            top: 60px;
            height: 80px;
            width: 10px;">
              <div style="height: 80px;
                  width: 100px;
                  text-align: center;
                  font-size: 20px;">
                <a-icon type="video-camera" style="fontSize:20px;padding: 0 0 10px 0"/><br/>
                發(fā)視頻
 </div>
            </div>
            </div>
            <a-divider style="margin:17px 0 13px 0;"/>
            <a-row>
              <a-col :span="12" style="padding: 10px 0px;font-size: 20px;">
                稍后發(fā)
 </a-col>
              <a-divider type="vertical" style="height: 50px; position: absolute;right: 125px;"/>
              <a-col :span="12" style="padding: 10px 0px;font-size: 20px;">
                存草稿
 </a-col>
            </a-row>
          </div>
        </a-layout>
      </a-layout>
      </a-layout>
  </div>
</template>
<!--import { Divider } from 'antd';-->
<script>
export default {
  name: 'mainPage',
  data () {
    return {
      questions: {
          question_id:''
 },
      user_id:'',
      user_name:'',
    }
  },
  components:{
  },
  created:function() {
    console.log('created');
    this.getParameter();
    this.$nextTick(() => {
      // 在此處執(zhí)行你要執(zhí)行的函數(shù)
 this.getAllQuestions();
    })
  },
  methods: {
    getParameter(){
      // 將數(shù)據(jù)放在當(dāng)前組件的數(shù)據(jù)內(nèi)
 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);
      });
    },
  },
}
</script>
<style scoped>
@import "../assets/index.css";
</style>


如需其他部分的代碼,愿意及時奉上。

? 最佳回答:

就是上邊朋友說的……

 <h style="font-size: 15px" >{{item.user_name}}&nbsp;的提問期待你的解答</h><br/>
                <div style="float:right;background: red;font-size: 18px;padding:5px;color:white">未終結(jié)</div>
                <h id="question_title" style="font-size:20px;font-weight: bold">{{item.question_name}}</h><br/>
                <a @click="getAllAnswers">{{item.question_text}}&nbsp;&nbsp;查看全文&nbsp;<a-icon type="down" /></a><br/><br/>

這里面的<h>你沒有注冊。

export default {
  name: 'mainPage',
  data () {
    return {
      questions: {
          question_id:''
 },
      user_id:'',
      user_name:'',
    }
  },
  components:{
  },

components這里注冊一下

主站蜘蛛池模板: 精品国产a∨无码一区二区三区| 一区二区三区在线| 精品一区二区三区在线观看l| 亚洲码欧美码一区二区三区| 久久精品无码一区二区app | 变态拳头交视频一区二区| 中文字幕无线码一区二区 | 久久久久99人妻一区二区三区| 日韩精品一区二区三区老鸦窝| 亚洲国产成人精品无码一区二区| 中文字幕一区二区三区日韩精品| 国产av夜夜欢一区二区三区| 国产成人一区二区在线不卡| 欧美日本精品一区二区三区| 呦系列视频一区二区三区| 精品人伦一区二区三区潘金莲| 中文字幕一区二区人妻性色| 91一区二区三区| 国产一区二区三区在线观看精品| 欧洲精品码一区二区三区免费看| 动漫精品第一区二区三区| 免费一区二区无码视频在线播放| 国产伦精品一区二区三区在线观看 | 亚洲av日韩综合一区二区三区| 精品国产一区二区三区无码| 3d动漫精品啪啪一区二区免费| 91大神在线精品视频一区| 精品国产乱子伦一区二区三区| 精品国产一区二区三区久久久狼 | 亚洲日本一区二区三区在线| 久久精品免费一区二区三区| 中文字幕一区二区三区久久网站| 亚洲美女一区二区三区| 在线精品一区二区三区| 国产情侣一区二区| 一区二区高清视频在线观看| 99久久国产精品免费一区二区| 无码人妻精品一区二区三区99仓本| 88国产精品视频一区二区三区| 亚洲一区二区三区在线观看网站| 国产在线精品观看一区|