You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

141 lines
3.5 KiB

/* 公共引入,勿随意修改,修改时需经过确认 */
import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Element from 'element-ui'
import './styles/element-variables.scss'
import '@/styles/index.scss' // global css
import elTableTransfer from 'el-table-transfer'
Vue.use(elTableTransfer)
import App from './App'
import store from './store'
import router from './router'
import i18n from './lang' // internationalization
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import axios from './axios'
import * as filters from './filters' // global filters全局过滤器
import 'babel-polyfill'
/** 常用flex组件 */
import Flexbox from "@/components/flexbox/flexbox";
import FlexboxItem from "@/components/flexbox/flexbox-item";
import './directives'
Vue.component('flexbox', Flexbox)
Vue.component('flexbox-item', FlexboxItem)
/** 事件传递 */
import VueBus from 'vue-bus'
Vue.use(VueBus)
Vue.prototype.$host = 'http://114.116.225.148:8000' // 服务器路径常量--用于存图片路径
//Vue.prototype.$host = 'http://localhost:9527' // 服务器路径常量
import infiniteScroll from 'vue-infinite-scroll'
Vue.use(infiniteScroll)
// 引入css
import 'vue-happy-scroll/docs/happy-scroll.css'
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online ! ! !
*/
if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock')
mockXHR()
}
Vue.use(Element, {
size: Cookies.get('size') || 'medium', // set element-ui default size
i18n: (key, value) => i18n.t(key, value)
})
// register global utility filters
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.prototype.$axios = axios
Vue.config.productionTip = false
/*使用icon*/
import './assets/iconfont/iconfont.css'
import './assets/iconfont/iconfont'
import IconSvg from '@/components/iconfontV/iconfont.vue'
//全局注册icon-svg
Vue.component('icon-svg', IconSvg)
/** 懒加载图片 */
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
preLoad: 1.3,
error: require('@/assets/img/send_img.png'),
loading: require('@/assets/img/loading.gif'),
attempt: 1
})
import moment from 'moment'
moment.locale('zh_cn')
// 自定义全局点击空白处组件
import clickoutside from './directive'
Vue.directive('clickoutside', clickoutside)
// 注册一个全局自定义指令 `v-focus`
Vue.directive('focus', {
// 当被绑定的元素插入到 DOM 中时……
inserted: function (el) {
// 聚焦元素
el.focus()
el.querySelector('input').focus()
}
})
//自定义指令
import empty from './directive/empty'
Vue.use(empty)
import photo from './directive/photo'
Vue.use(photo)
import cache from '@/utils/cache'
cache.loadingCache()
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
// 全局监听错误信息
Vue.config.errorHandler = function (err, vm, info) {
console.log('错误信息:::', err)
console.log('vue 实例', vm)
console.log('错误信息', info)
// handle error
// `info` 是 Vue 特定的错误信息,比如错误所在的生命周期钩子
// 只在 2.2.0+ 可用
}
new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
})