app.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. const router = new VueRouter({routes});
  25. //进度条配置
  26. ViewUI.LoadingBar.config({
  27. color: '#3fcc25',
  28. failedColor: '#ff0000'
  29. });
  30. router.beforeEach((to, from, next) => {
  31. ViewUI.LoadingBar.start();
  32. next();
  33. });
  34. router.afterEach((to, from, next) => {
  35. ViewUI.LoadingBar.finish();
  36. });
  37. //加载函数
  38. Vue.prototype.goForward = function(location, isReplace) {
  39. if (typeof location === 'string') location = {name: location};
  40. if (isReplace === true) {
  41. this.$router.replace(location);
  42. }else{
  43. this.$router.push(location);
  44. }
  45. };
  46. //返回函数
  47. Vue.prototype.goBack = function(number) {
  48. window.history.go(typeof number==='number'?number:-1)
  49. };
  50. Vue.prototype.$A = $A;
  51. Vue.config.productionTip = false;
  52. const app = new Vue({
  53. el: '#app',
  54. router,
  55. template: '<App/>',
  56. components: { App }
  57. });
  58. $A.app = app;