fix: 修复element-plus全局组件大小设置无效调整为config-provider方式

Former-commit-id: ddb0e86a2ab660fb442c7425d475d29bf58b8a6d
This commit is contained in:
郝先瑞
2022-05-01 18:28:50 +08:00
parent 192227edea
commit e79c9477e7
3 changed files with 4 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<template>
<el-config-provider :locale="locale">
<router-view/>
<el-config-provider :locale="locale" :size="size">
<router-view />
</el-config-provider>
</template>
@@ -17,6 +17,7 @@ import en from "element-plus/es/locale/lang/en";
const { app } = useStore();
const language = computed(() => app.language);
const size: any = computed(() => app.size);
const locale = ref();

View File

@@ -32,7 +32,6 @@ const sizeOptions = ref([
function handleSetSize(size: string) {
app.setSize(size);
window.location.reload();
ElMessage.success("切换布局大小成功");
}
</script>

View File

@@ -38,6 +38,6 @@ app.config.globalProperties.$listDictsByCode = listDictsByCode
app.component('Pagination', Pagination)
.use(createPinia())
.use(router)
.use(ElementPlus, {size: localStorage.get('size') || 'default'})
.use(ElementPlus)
.use(i18n)
.mount('#app')