说明
本示例演示了通过插件同时编辑多个文件。
如需了解详细的API教程以及参数说明,请参考DDei文档
一、开启多文件编辑
开启多文件编辑
后,设计器会出现已打开文件列表,点击文件列表可以切换编辑的文件。
demo.vue
<script setup lang="ts">
import DDeiEditorView from "ddei-editor";
import { DDeiCoreStandLayout } from "ddei-editor";
import { DDeiCoreOpenFilesViewPanel } from "ddei-editor"; // [!code ++]
const options = {
config: {
"grid": 0, //网格线 // [!code --]
"background": { color: "blue", opacity: 0.1 }, //背景色 // [!code --]
initData: {
controls: [
{
model: "102010",
text: "初始化图形",
}
]
}
},
//配置扩展插件
extensions: [
//布局的配置
DDeiCoreStandLayout.configuration({
//配置插件
'top': [],
'middle': ['ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],// [!code --]
'middle': ['ddei-core-panel-openfilesview','ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],// [!code ++]
'bottom': [],
'left': [],
'right': []
}),
],
}
</script>
<template>
<div style="width:400px;height:400px;margin:100px auto;">// [!code --]
<DDeiEditorView :options="options" id="ddei_editor_1"></DDeiEditorView>
</div>// [!code --]
</template>
实时效果
二、文件最大打开数
通过配置多文件编辑插件
,可以设置最大支持打开文件的数量。
demo.vue
<script setup lang="ts">
import DDeiEditorView from "ddei-editor";
import { DDeiCoreStandLayout } from "ddei-editor";
import { DDeiCoreOpenFilesViewPanel } from "ddei-editor"; // [!code ++]
const options = {
config: {
"grid": 0, //网格线 // [!code --]
"background": { color: "blue", opacity: 0.1 }, //背景色 // [!code --]
initData: {
controls: [
{
model: "102010",
text: "初始化图形",
}
]
}
},
//配置扩展插件
extensions: [
//布局的配置
DDeiCoreStandLayout.configuration({
//配置插件
'top': [],
'middle': ['ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],// [!code --]
'middle': ['ddei-core-panel-openfilesview','ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],// [!code ++]
'bottom': [],
'left': [],
'right': []
}),
//配置多文件插件 // [!code ++:4]
DDeiCoreOpenFilesViewPanel.configuration({
max:3
})
],
}
</script>
<template>
<div style="width:400px;height:400px;margin:100px auto;">// [!code --]
<DDeiEditorView :options="options" id="ddei_editor_1"></DDeiEditorView>
</div>// [!code --]
</template>
实时效果
技术支持
仓库信息
源码: https://gitee.com/hoslay/ddei-editor
在线体验: https://www.ddei.top