Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
122 views
in Technique[技术] by (71.8m points)

vue模板套用问题

被套用的模板

<template>
  <div id="goodsd-page">
    goodsd
  </div>
</template>
<script>
import sendRequest from '../js/req.js'
export default {
  name: 'goodsd',
  data() {
      return {
      }
  },
}
</script>

引用的模板

<template>
  <div id="app">
    <div class="top-nav">
      <router-link to="/" exact class="link-dafult"><span>首页</span></router-link>
      <router-link to="/news" class="link-dafult"><span>新闻动态</span></router-link>
      <router-link to="/goods" class="link-dafult"><span>产品展示</span></router-link>
      <router-link to="/about" class="link-dafult"><span>关于我们</span></router-link>
      <router-link to="/buy" class="link-dafult buy"><span>我要下单</span></router-link>
    </div>
    <router-view class="wrap"></router-view>
    <div class="bottom-wrap">
      <img src="http://of0zdndod.bkt.clouddn.com/static/img/bg.png" />
    </div>
    <goodsd></goodsd>
  </div>
</template>
<script>
import goodsd from '@/components/page/goodsdetail'
export default {
  name: 'app',
  data() {
      return {   
      }
  }
}
</script>

这样引用报错
vue.esm.js?d2fe:558 [Vue warn]: Unknown custom element: <goodsd> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in <App> at F:testzygzzygwsrcApp.vue)
新手求解,谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

引用了之后需要注册

components:{
   goodsd 
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...