app.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import routes from './routes'
  4. import VueRouter from 'vue-router'
  5. import ViewUI from 'view-design';
  6. import Language from '../_modules/language'
  7. import '../common'
  8. import './main'
  9. Vue.use(VueRouter);
  10. Vue.use(ViewUI);
  11. Vue.use(Language);
  12. import Title from '../_components/Title.vue'
  13. import sreachTitle from '../_components/sreachTitle.vue'
  14. import UserInput from './components/UserInput'
  15. import UserView from './components/UserView'
  16. import WLoading from './components/WLoading'
  17. Vue.component('VTitle', Title);
  18. Vue.component('sreachTitle', sreachTitle);
  19. Vue.component('UserInput', UserInput);
  20. Vue.component('UserView', UserView);
  21. Vue.component('WLoading', WLoading);
  22. import TaskDetail from './components/project/task/detail'
  23. Vue.prototype.taskDetail = TaskDetail;
  24. import ReportDetail from './components/report/detail'
  25. Vue.prototype.reportDetail = ReportDetail;
  26. const originalPush = VueRouter.prototype.push
  27. VueRouter.prototype.push = function push(location) {
  28. return originalPush.call(this, location).catch(err => err)
  29. }
  30. const router = new VueRouter({routes});
  31. //进度条配置
  32. ViewUI.LoadingBar.config({
  33. color: '#3fcc25',
  34. failedColor: '#ff0000'
  35. });
  36. router.beforeEach((to, from, next) => {
  37. ViewUI.LoadingBar.start();
  38. next();
  39. });
  40. router.afterEach((to, from, next) => {
  41. ViewUI.LoadingBar.finish();
  42. });
  43. //加载函数
  44. Vue.prototype.goForward = function(location, isReplace) {
  45. if (typeof location === 'string') location = {name: location};
  46. if (isReplace === true) {
  47. this.$router.replace(location);
  48. }else{
  49. this.$router.push(location);
  50. }
  51. };
  52. //返回函数
  53. Vue.prototype.goBack = function(number) {
  54. window.history.go(typeof number==='number'?number:-1)
  55. };
  56. Vue.prototype.$A = $A;
  57. Vue.config.productionTip = false;
  58. const app = new Vue({
  59. el: '#app',
  60. router,
  61. template: '<App/>',
  62. components: { App }
  63. });
  64. $A.app = app;
  65. window.localStorage.setItem("__::WookTeam:check", "success")