fix: 导出 PPTX 支持默认以外的其他尺寸比例

This commit is contained in:
pipipi-pikachu 2022-05-22 17:21:13 +08:00
parent 7149b08d72
commit 8bfe9c1daa
2 changed files with 10 additions and 6 deletions

View File

@ -20,7 +20,7 @@ interface ExportImageConfig {
} }
export default () => { export default () => {
const { slides, theme } = storeToRefs(useSlidesStore()) const { slides, theme, viewportRatio } = storeToRefs(useSlidesStore())
const exporting = ref(false) const exporting = ref(false)
@ -335,6 +335,10 @@ export default () => {
exporting.value = true exporting.value = true
const pptx = new pptxgen() const pptx = new pptxgen()
if (viewportRatio.value === 0.625) pptx.layout = 'LAYOUT_16x10'
else if (viewportRatio.value === 0.75) pptx.layout = 'LAYOUT_4x3'
else pptx.layout = 'LAYOUT_16x9'
const { color: bgColor, alpha: bgAlpha } = formatColor(theme.value.backgroundColor) const { color: bgColor, alpha: bgAlpha } = formatColor(theme.value.backgroundColor)
pptx.defineSlideMaster({ pptx.defineSlideMaster({
title: 'PPTIST_MASTER', title: 'PPTIST_MASTER',

View File

@ -46,13 +46,13 @@ export default defineComponent({
overflow: hidden; overflow: hidden;
} }
.preview { .preview {
width: calc(100% - 20px); width: 100%;
height: calc(100% - 100px); height: calc(100% - 100px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
background-color: #2d2d30; background-color: #f9f9f9;
color: #fff; color: #0451a5;
} }
.btns { .btns {
width: 300px; width: 300px;
@ -72,9 +72,9 @@ export default defineComponent({
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; height: 10px;
background-color: #2d2d30; background-color: #f9f9f9;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: #777; background-color: #c1c1c1;
} }
</style> </style>