Demo:导出图片支持选择格式

This commit is contained in:
wanglin2 2025-04-06 20:20:48 +08:00
parent 7d4acd15d0
commit f9406011e2
4 changed files with 18 additions and 5 deletions

View File

@ -172,7 +172,8 @@ export default {
addFooterText: 'Add text at the footer', addFooterText: 'Add text at the footer',
desc: 'Desc', desc: 'Desc',
options: 'Options', options: 'Options',
isFitBg: 'Whether to display the complete background image (effective when a background image is used)' isFitBg: 'Whether to display the complete background image (effective when a background image is used)',
format: 'Format'
}, },
fullscreen: { fullscreen: {
fullscreenShow: 'Full screen show', fullscreenShow: 'Full screen show',

View File

@ -167,7 +167,8 @@ export default {
addFooterTextPlaceholder: '比如来自simple-mind-map', addFooterTextPlaceholder: '比如来自simple-mind-map',
desc: '说明', desc: '说明',
options: '选项', options: '选项',
isFitBg: '是否显示完整背景图片(使用了背景图片时生效)' isFitBg: '是否显示完整背景图片(使用了背景图片时生效)',
format: '格式'
}, },
fullscreen: { fullscreen: {
fullscreenShow: '全屏查看', fullscreenShow: '全屏查看',

View File

@ -168,7 +168,8 @@ export default {
addFooterTextPlaceholder: '例如:來自 simple-mind-map', addFooterTextPlaceholder: '例如:來自 simple-mind-map',
desc: '說明', desc: '說明',
options: '選項', options: '選項',
isFitBg: '是否顯示完整背景圖片(使用了背景圖片時生效)' isFitBg: '是否顯示完整背景圖片(使用了背景圖片時生效)',
format: '格式'
}, },
fullscreen: { fullscreen: {
fullscreenShow: '全螢幕檢視', fullscreenShow: '全螢幕檢視',

View File

@ -61,6 +61,13 @@
class="valueItem" class="valueItem"
v-show="['svg', 'png', 'pdf'].includes(exportType)" v-show="['svg', 'png', 'pdf'].includes(exportType)"
> >
<div class="valueSubItem" v-if="['png'].includes(exportType)">
<span class="name">{{ $t('export.format') }}</span>
<el-radio-group v-model="imageFormat">
<el-radio label="png">PNG</el-radio>
<el-radio label="jpg">JPG</el-radio>
</el-radio-group>
</div>
<div class="valueSubItem"> <div class="valueSubItem">
<span class="name">{{ $t('export.paddingX') }}</span> <span class="name">{{ $t('export.paddingX') }}</span>
<el-input <el-input
@ -142,7 +149,8 @@ export default {
paddingY: 10, paddingY: 10,
extraText: '', extraText: '',
isMobile: isMobile(), isMobile: isMobile(),
isFitBg: true isFitBg: true,
imageFormat: 'png'
} }
}, },
computed: { computed: {
@ -227,7 +235,7 @@ export default {
} else if (this.exportType === 'png') { } else if (this.exportType === 'png') {
this.$bus.$emit( this.$bus.$emit(
'export', 'export',
this.exportType, this.imageFormat,
true, true,
this.fileName, this.fileName,
this.isTransparent, this.isTransparent,
@ -525,6 +533,7 @@ export default {
.valueItem { .valueItem {
.valueSubItem { .valueSubItem {
margin-bottom: 12px; margin-bottom: 12px;
display: flex;
&:last-of-type { &:last-of-type {
margin-right: 0; margin-right: 0;
@ -532,6 +541,7 @@ export default {
.name { .name {
margin-right: 12px; margin-right: 12px;
width: 100px;
} }
} }
} }