2017-03-12 11 views
0

LaravelでVueを使用しようとしています。 example.vueを変更してビューに追加すると、変更は表示されません。これは、Laravelが持っている.vueの例です。Vue2がLaravelで変更されない5.4

<template> 
    <div class="container"> 
     <div class="row"> 
      <div class="col-md-8 col-md-offset-2"> 
       <div class="panel panel-default"> 
        <div class="panel-heading">Example Component</div> 

        <div class="panel-body"> 
         I'm an example component! 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</template> 

<script> 
    export default { 
     mounted() { 
      console.log('Component mounted.') 
     } 
    } 
</script> 

私はこのファイルを修正し、NPMの実行DEVを実行しようとしましたが、何の変更を表示しません。何か案が?

答えて

0

app.jsでrequire行のコメントを解除する必要がある場合があります。 Laravel 5.4では/resources/assets/js/app.jsファイルにあります。

/** 
* First we will load all of this project's JavaScript dependencies which 
* includes Vue and other libraries. It is a great starting point when 
* building robust, powerful web applications using Vue and Laravel. 
*/ 

require('./bootstrap'); 

/** 
* Next, we will create a fresh Vue application instance and attach it to 
* the page. Then, you may begin adding components to this application 
* or customize the JavaScript scaffolding to fit your unique needs. 
*/ 

// Vue.component('example', require('./components/Example.vue')); 
// ^^^^^^^^^^^^^^^^^^^^^^ Uncomment this line ^^^^^^^^^^^^^^^^^^^^^^ 

const app = new Vue({ 
    el: '#app' 
}); 
+0

これは私にとっては機能しません – SpaceNet

関連する問題