65 lines
1.4 KiB
Vue
65 lines
1.4 KiB
Vue
<template>
|
|
<a-config-provider :locale="locale">
|
|
<router-view />
|
|
<component
|
|
v-for="(value,key) in components"
|
|
:key="key"
|
|
:is="key"
|
|
:ref="(el)=> initGlobal(key,el)"
|
|
></component>
|
|
</a-config-provider>
|
|
</template>
|
|
|
|
<script>
|
|
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
|
import dayjs from 'dayjs';
|
|
import 'dayjs/locale/zh-cn';
|
|
dayjs.locale('zh-cn');
|
|
import { onMounted,reactive } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import globalComponent from '@/system/plugins/global';
|
|
import config from '$config/config';
|
|
import buttonRole from '@/components/screen/data/buttonRole';
|
|
const globalComponents = globalComponent.getComponents();
|
|
|
|
export default {
|
|
|
|
setup(){
|
|
|
|
const selector = {};
|
|
const components = reactive({});
|
|
|
|
for (let key in globalComponents) {
|
|
if (globalComponents.hasOwnProperty(key)) {
|
|
selector[key.replace('v-','$')] = null;
|
|
components[key] = key;
|
|
}
|
|
}
|
|
|
|
const initGlobal = function (key,el) {
|
|
selector[key.replace('v-','$')] = el;
|
|
}
|
|
|
|
onMounted(function () {
|
|
globalComponent.register(selector);
|
|
});
|
|
|
|
config.install({
|
|
router: useRouter()
|
|
});
|
|
|
|
// 处理按钮权限时使用
|
|
// buttonRole.handleUserPermissionToCode();
|
|
|
|
return {
|
|
locale: zhCN,
|
|
components,
|
|
initGlobal
|
|
}
|
|
},
|
|
components:globalComponents
|
|
|
|
}
|
|
</script>
|
|
<style src="./system/styles/index.scss" lang="scss"></style>
|