javascript - Laravel Material Design 主题奇怪的行为
问题描述
最近我安装了Laravel Material Design主题。我设法很好地设置了所有内容,并且一切正常,直到我添加了一些vue.js templates
. 当我导入我的app.js
文件时,我的模板被加载到那里,主题的一些功能刚刚停止工作,我不知道为什么。这是我的app.js
文件:
require('./bootstrap');
window.Vue = require('vue');
Vue.component('users-component', require('./components/UsersComponent').default);
Vue.component('blogs-component', require('./components/BlogsComponent').default);
Vue.component('news-component', require('./components/NewsComponent').default);
Vue.component('paginator', require('./components/Paginator.vue').default);
const app = new Vue({
el: '#vue',
});
因此,我编译了文件,并将其导入到app.blade.php
布局的底部:
....
<script src="{{ mix('/js/app.js') }}" defer></script>
当我加载我的页面时,我vue.js templates
的工作正常。问题是,主题导航刚刚停止工作,我无法单击导航列表:
我开始调查,在浏览器控制台中,我看到以下错误:
当我app.js
从布局中删除文件时,导航再次开始工作,我在控制台中看不到任何错误,但当然,我vue.js templates
的工作不正常。这是我的布局中导入脚本的完整列表:
<!-- Core JS Files -->
<script src="{{ asset('material') }}/js/core/jquery.min.js"></script>
<script src="{{ asset('material') }}/js/core/popper.min.js"></script>
<script src="{{ asset('material') }}/js/core/bootstrap-material-design.min.js"></script>
<script src="{{ asset('material') }}/js/plugins/perfect-scrollbar.jquery.min.js"></script>
<!-- Plugin for the momentJs -->
<script src="{{ asset('material') }}/js/plugins/moment.min.js"></script>
<!-- Plugin for Sweet Alert -->
<script src="{{ asset('material') }}/js/plugins/sweetalert2.js"></script>
<!-- Forms Validations Plugin -->
<script src="{{ asset('material') }}/js/plugins/jquery.validate.min.js"></script>
<!-- Plugin for the Wizard, full documentation here: https://github.com/VinceG/twitter-bootstrap-wizard -->
<script src="{{ asset('material') }}/js/plugins/jquery.bootstrap-wizard.js"></script>
<!-- Plugin for Select, full documentation here: http://silviomoreto.github.io/bootstrap-select -->
<script src="{{ asset('material') }}/js/plugins/bootstrap-selectpicker.js"></script>
<!-- Plugin for the DateTimePicker, full documentation here: https://eonasdan.github.io/bootstrap-datetimepicker/ -->
<script src="{{ asset('material') }}/js/plugins/bootstrap-datetimepicker.min.js"></script>
<!-- DataTables.net Plugin, full documentation here: https://datatables.net/ -->
<script src="{{ asset('material') }}/js/plugins/jquery.dataTables.min.js"></script>
<!-- Plugin for Tags, full documentation here: https://github.com/bootstrap-tagsinput/bootstrap-tagsinputs -->
<script src="{{ asset('material') }}/js/plugins/bootstrap-tagsinput.js"></script>
<!-- Plugin for Fileupload, full documentation here: http://www.jasny.net/bootstrap/javascript/#fileinput -->
<script src="{{ asset('material') }}/js/plugins/jasny-bootstrap.min.js"></script>
<!-- Full Calendar Plugin, full documentation here: https://github.com/fullcalendar/fullcalendar -->
<script src="{{ asset('material') }}/js/plugins/fullcalendar.min.js"></script>
<!-- Vector Map plugin, full documentation here: http://jvectormap.com/documentation/ -->
<script src="{{ asset('material') }}/js/plugins/jquery-jvectormap.js"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="{{ asset('material') }}/js/plugins/nouislider.min.js"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support SweetAlert -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.js"></script>
<!-- Library for dynamically adding elements -->
<script src="{{ asset('material') }}/js/plugins/arrive.min.js"></script>
<!-- Chartist JS -->
<script src="{{ asset('material') }}/js/plugins/chartist.min.js"></script>
<!-- Notifications Plugin -->
<script src="{{ asset('material') }}/js/plugins/bootstrap-notify.js"></script>
<!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->
<script src="{{ asset('material') }}/js/material-dashboard.js?v=2.1.1" type="text/javascript"></script>
<script src="{{ mix('/js/app.js') }}" defer></script>
@stack('js')
@if(isset($scripts))
@foreach($scripts as $key => $value)
<script src="{{ asset($value)}}"></script>
@endforeach
@endif
这里似乎有什么问题。任何帮助表示赞赏。
更新:
这是 bootsrtap.js:
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
解决方案
推荐阅读
- sql - 如何在 SQL Server 中获取插值?
- java - 有没有什么办法只有在我从 Android 中的 Firebase 获取数据后才能继续?
- excel - 使用 VBA 将特定字符更新为不同的字体
- python - Python 对齐文本
- mysql - 根据 MySQL 中的三列从一列中挑选并仅显示最高值
- php - 使用 php 文件将来自 **L.tileLayer()** 函数的 GET 请求转发到 localhost
- git - 在与 meld 的 git 合并期间,如果只保存 MERGED,为什么我可以修改 LOCAL 和 REMOTE?
- php - 在 WordPress 网站上添加登录功能并向用户显示特定内容
- python - 将进度条或仪表小部件添加到 PyQtGraph
- django - 如何从石墨烯返回自定义错误消息?