app.js 1.3 KB

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