app.js 1.6 KB

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