rt-sim-training-client/src/scripts/GlobalPlugin.js

36 lines
987 B
JavaScript
Raw Normal View History

2019-07-02 16:29:52 +08:00
import Vue from 'vue'
import QueryListPage from '@/components/QueryListPage/QueryListPage'
import DataForm from '@/components/QueryListPage/DataForm'
import TurnbackBar from '@/components/TurnbackBar'
import ConstConfig from '@/scripts/ConstConfig'
// 全局组件
Vue.component('DataForm', DataForm)
Vue.component('QueryListPage', QueryListPage)
Vue.component('TurnbackBar', TurnbackBar)
Vue.prototype.$ConstSelect = (function() {
ConstConfig.ConstSelect.translate = function(value, codeName) {
if (codeName) {
const obj = this[codeName].filter(function(item) {
return item.value === value
})[0]
return obj && obj.label
}
}
return ConstConfig.ConstSelect
}())
Vue.prototype.__windowResizeFlag = false
Vue.prototype.$addWindowResizeListener = function(cb) {
window.addEventListener('resize', function() {
if (!Vue.__windowResizeFlag) {
Vue.__windowResizeFlag = true
setTimeout(function() {
Vue.__windowResizeFlag = false
cb()
}, 100)
}
})
}