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

View File

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

View File

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