模仿慕课网教程里的移动端音乐app,为什么run dev后不显示组件呢。请各位帮忙看看。
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=0,maximum-scale=1.0
minimum-scale=1.0,userscalable=no">
<title>vue-music</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
app.vue
<template>
<div id="app">
<m-header></m-header>
<tab></tab>
<router-view></router-view>
<hello></hello>
</div>
</template>
<script type="text/ecmascript-6">
import MHeader from 'components/m-header/m-header'
import Tab from 'components/tab/tab'
import Hello from 'components/hello/hello'
export default {
name: 'app',
components: {
MHeader,
Tab,
Hello
}
}
</script>
<style scoped lang ="stylus" rel="stylesheet/stylus">
</style>
main.js
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import fastclick from 'fastclick'
import 'common/stylus/index.styl'
import router from './router'
fastclick.attachEvent(document.body)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
render: h => h(App)
})
router/index.js
import Vue from 'vue'
import Router from 'vue-router'
import Recommend from 'components/recommend/recommend'
import Rank from 'components/rank/rank'
import Search from 'components/search/search'
import Singer from 'components/singer/singer'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
redirect: Recommend
},
{
path: '/recommend',
component: Recommend
},
{
path: '/rank',
component: Rank
},
{
path: '/singer',
component: Singer
},
{
path: '/search',
component: Search
}
]
})
其中一个组件components/m-header.vue
<template>
<div class="m-header">
<div class="icon">
<h1 class="text">william music</h1>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
@import "~common/stylus/variable.styl"
@import "~common/stylus/mixin.styl"
.m-header
position:relative
height:40px
text-align:center
color: $color-theme
font-size :0
.icon
display :inline-block
vertical-align :top
margin-top : 6px
width : 30px
height :32px
margin-right :9px
bg-image('logo')
background-size :30px 32px
.text
display :inline-block
vertical-align :top
line-height :44px
font-size: $font-size-large
.mine
position: absolute
top: 0
right: 0
.icon-mine
display: block
padding: 12px
font-size: 20px
color: $color-theme
</style>
页面只显示黑色背景,看源码发现组件都没挂载上,只有一个空的html页面。
引入组件的路径不正确