app.js 1.4 KB

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