vue.esm.js?efeb:628 [Vue warn]: Unknown custom element: <dv> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <Home> at src/components/home.vue
<App> at src/App.vue
<Root>
报该错误请大佬们解答,
路由如下
import Vue from 'vue' import Router from 'vue-router' import home from "../components/home"; import login from "../components/login"; import more from "../components/more"; import 'element-ui/lib/theme-chalk/index.css'; import ElementUI from 'element-ui'; // import { // Button,Icon,Link,Radio,Row,Col,Container,Header,Main,Footer,Aside, // Carousel,CarouselItem, // } from 'element-ui'; Vue.use(ElementUI) Vue.use(Router) export default new Router({ routes: [ { path:'/', redirect:"/home" }, { path: '/home', component:home }, { path: '/login', component:login }, { path: '/more', component:more }, ] }) main 如下
import Vue from 'vue' import App from './App' import router from './router' import store from './store' import vuex from 'vuex' Vue.use(vuex) Vue.config.productionTip = false new Vue({ el: '#app', router, store, components: { App }, template: '<App/>' })
其中一个views视图的vue如下
<script> import {searchMusic,musicPlay,hotMusic,hotComment} from "../Api/api.js"; export default { name: "home", created() { hotMusic().then((res)=>{ console.log(res); this.musicList=res.data.data.dailySongs; console.log(this.musicList) }) }, data() { return { //用户输入 user_input:'', //歌曲列表 musicList: [], //歌曲地址 musicSrc:'', //歌曲列表显示或隐藏 active:true, //歌曲列表标题切换 titleActive:false, //歌曲头像 mAvatar:'', //头像显示指针 isAvatar:false, //评论列表 commentList:[], //歌曲评论指针 com_body:false, } }, methods:{ //歌曲搜索 searchMusic(){ var that = this; searchMusic({keywords:this.user_input}).then((res)=>{ console.log(res) that.musicList =res.data.result.songs; console.log(that.musicList) that.active = true; this.titleActive=true; }) }, //关闭搜索列表 cls(){ this.active = false; }, //打开搜索列表 opn(){ this.active = !this.active; }, // 歌曲播放 playMusic(id,index){ var that= this; //调出歌曲头像和评论 this.com_body=true; this.isAvatar= true; musicPlay({id:id}).then((res)=>{ // console.log(res) // console.log(id) that.musicSrc = res.data.data[0].url; // console.log(that.musicSrc) that.mAvatar = that.musicList[index].al.picUrl hotComment({id:id}).then((res)=>{ console.log(res) }) hotComment({id:id,limit:50}).then((res)=>{ console.log("--------") console.log(res) that.commentList = res.data.comments; }) }) } } } </script>