import Vue from 'vue'
|
import ElementUI from 'element-ui'
|
import 'element-ui/lib/theme-chalk/index.css'
|
import App from './App.vue'
|
import router from './router'
|
import './styles/global.css'
|
import { installSensitiveWords } from './utils/sensitive'
|
import { loadDictionary } from './utils/dict'
|
|
Vue.use(ElementUI, { size: 'small' })
|
Vue.config.productionTip = false
|
|
Vue.prototype.$appName = 'rk_SystemName'
|
|
Vue.prototype.$hasPermission = function(code) {
|
const raw = sessionStorage.getItem('permissions')
|
if (raw === null) return true
|
try {
|
const list = JSON.parse(raw)
|
if (!Array.isArray(list)) return true
|
return list.indexOf(code) >= 0
|
} catch (e) {
|
return true
|
}
|
}
|
|
Vue.directive('permission', {
|
inserted(el, binding) {
|
if (binding.value && !Vue.prototype.$hasPermission(binding.value) && el.parentNode) {
|
el.parentNode.removeChild(el)
|
}
|
}
|
})
|
|
loadDictionary().then(() => {
|
new Vue({
|
router,
|
render: h => h(App)
|
}).$mount('#app')
|
|
installSensitiveWords()
|
})
|