2017-12-06 4 views
1

I持っていると私は、次のエラー取得しています次のコード:私はどのように私は達成することができますapp.vue に上部と下部のナビゲーションを含めるVueのJsの複数のコンポーネント

Failed to mount component: template or render function not defined. 

をそれ?

Main.js:

new Vue({ 
    el: '#app', 
    router, 
    template: '<App/>', 
    components: { 'App':App } 
}) 

App.vue:

<template> 
    <div id="app"> 
     <navigationtop></navigationtop> 
     <navigationbottom></navigationbottom> 
     <router-view/> 
    </div> 
</template> 
<script> 
    import navigationtop from './components/navigation/top' 
    import navigationbottom from './components/navigation/bottom' 

    export default { 
     name: 'app', 
     components: { 
      'navigationtop': navigationtop, 
      'navigationbottom': navigationbottom 
     } 
    }...... 

ルータ:

export default new Router({ 
routes: [ 
    { 
    path: '/', 
    name: 'HelloWorld', 
    component: HelloWorld 
    } 
] 
}) 

のHelloWorld:

<template> </template> 
<script> 
export default { 
    name: 'HelloWorld', 
    data() { 
    return { 
     msg: 'Welcome to Your Vue.js App'}}} 
</script> 

enter image description here

+0

あなたが使用されているコンポーネントのコードを含めることができますAppコンポーネントでは? HelloWorldでも同じですが、問題がある可能性があります。 – dlopez

+0

あなたのvueオブジェクトの中に 'rende()'メソッドが必要です – samayo

+0

@dlopez updated code – Bas

答えて

2

このようなあなたのアプリをインポートしよう:

import App from './foobar/App.vue' 

とのようなあなたのVue({})オブジェクト内にレンダリング:

new Vue({ 
    el: '#app', 
    router, 
    render: h => h(App) 
}) 
+0

そして、トップナビゲーションとボトムナビゲーションをどのようにレンダリングできますか? – Bas

+0

あなたはすでにあなたのApp.vueでそれらをレンダリングしています – samayo

+0

同じエラーがまだ表示されていますが、上記を参照してください:( – Bas

関連する問題