app.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 UseridInput from './components/UseridInput'
  14. import sreachTitle from '../_components/sreachTitle.vue'
  15. Vue.component('VTitle', Title);
  16. Vue.component('UseridInput', UseridInput);
  17. Vue.component('sreachTitle', sreachTitle);
  18. import TaskDetail from './components/project/task/detail'
  19. Vue.prototype.taskDetail = TaskDetail;
  20. const router = new VueRouter({routes});
  21. //进度条配置
  22. ViewUI.LoadingBar.config({
  23. color: '#3fcc25',
  24. failedColor: '#ff0000'
  25. });
  26. router.beforeEach((to, from, next) => {
  27. ViewUI.LoadingBar.start();
  28. next();
  29. });
  30. router.afterEach((to, from, next) => {
  31. ViewUI.LoadingBar.finish();
  32. });
  33. //加载函数
  34. Vue.prototype.goForward = function(location, isReplace) {
  35. if (typeof location === 'string') location = {name: location};
  36. if (isReplace === true) {
  37. this.$router.replace(location);
  38. }else{
  39. this.$router.push(location);
  40. }
  41. };
  42. //返回函数
  43. Vue.prototype.goBack = function(number) {
  44. window.history.go(typeof number==='number'?number:-1)
  45. };
  46. Vue.prototype.$A = $A;
  47. Vue.config.productionTip = false;
  48. const app = new Vue({
  49. el: '#app',
  50. router,
  51. template: '<App/>',
  52. components: { App }
  53. });
  54. $A.app = app;