2017-06-10 7 views
1

私はページにブートストラップモーダルを追加したいと思いましたが、ドキュメントの先頭にjQueryスクリプトを含めました。Laravel AdminLTEテンプレートVUEエラー

[Vue warn]: Error compiling template: 
... 
... 
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed. 


(found in <Root>) 

そして、私はまた、私の他のプロジェクトで同じモーダルを使用し、それが働いていたので、私が間違っているのか分からない:ここで私は言って、ページの読み込みにエラーが発生しますモーダル

<!-- Modal --> 
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header"> 
       Delete {{$title}}? 
      </div> 
      <div class="modal-body"> 
       Are you sure you want to delete {{$body}}? 
      </div> 
      <div class="modal-footer"> 
       <a class="btn btn-danger btn-ok">Yes</a> 
       <button type="button" class="btn btn-default" data-dismiss="modal">No</button> 
      </div> 
     </div> 
    </div> 
</div> 
<script> 
    $('#confirm-delete').on('show.bs.modal', function(e) { 
     $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href')); 
    }); 
</script> 

ですそれはすべきだ。

答えて

1

テンプレート内のすべての<script>タグを取り除いてテンプレートの外に置いてください。

この場合、bodyをテンプレートとして使用しており、テンプレート(body)内にスクリプトを配置し、ルート要素に終了タグが付いていることを確認してください。

+0

Vueを簡単に完全に削除できますか?私はそれが何かをコンパイルしたくない – Norgul

関連する問題