bootstrap_learnku.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. window._ = require('lodash');
  2. /**
  3. * We'll load the axios HTTP library which allows us to easily issue requests
  4. * to our Laravel back-end. This library automatically handles sending the
  5. * CSRF token as a header based on the value of the "XSRF" token cookie.
  6. */
  7. window.axios = require('axios');
  8. // X-Requested-With
  9. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  10. // Authorization
  11. let jwt_token = document.head.querySelector('meta[name="jwt-token"]');
  12. if(jwt_token) {
  13. window.axios.defaults.headers.common['Authorization'] = jwt_token.content;
  14. Config.isApi = true;
  15. }
  16. // X-CSRF-TOKEN
  17. let token = document.head.querySelector('meta[name="csrf-token"]');
  18. if (token) {
  19. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  20. } else {
  21. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  22. }
  23. /**
  24. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  25. * for JavaScript based Bootstrap features such as modals and tabs. This
  26. * code may be modified to fit the specific needs of your application.
  27. */
  28. try {
  29. window.Vue = require('vue');
  30. window.$ = window.jQuery = require('jquery');
  31. // https://sweetalert2.github.io/
  32. window.Swal = window.swal = require('sweetalert2');
  33. // https://semantic-ui.com/
  34. require('./SemanticUI/semantic');
  35. require('../ext/imglazyload/jquery.lazyload.js');
  36. // H5 图片上传
  37. require('../ext/upload-h5/upload');
  38. require('../ext/prism/prism.js');
  39. require('../ext/jquery/jquery-ui/jquery-ui.min.js');
  40. require('../ext/jquery/jquery.tocify/jquery.tocify.min.js');
  41. require('../ext/Fluidbox/dist/js/jquery.fluidbox.min.js');
  42. } catch (e) {}
  43. /**
  44. * Echo exposes an expressive API for subscribing to channels and listening
  45. * for events that are broadcast by Laravel. Echo and event broadcasting
  46. * allows your team to easily build robust real-time web applications.
  47. */
  48. // import Echo from 'laravel-echo'
  49. // window.Pusher = require('pusher-js');
  50. // window.Echo = new Echo({
  51. // broadcaster: 'pusher',
  52. // key: 'your-pusher-key',
  53. // cluster: 'mt1',
  54. // encrypted: true
  55. // });