Skip to content

图层

  本示例演示了通过配置和插件开启多图层功能,一个画布拥有多个图层。

  本示例基于教程快速指南开发,如果您不清楚怎样引入DDei设计器,请查看教程快速指南

  如需了解详细的API以及参数说明,请参考API文档

开启/关闭

  通过引入图层管理插件和参数GLOBAL_ALLOW_OPEN_MULT_LAYERS开启多图层功能,设计器会出现图层管理按钮,点击后可以管理图层。

demo.vue

vue
<script setup lang="ts">
import DDeiEditorView from "ddei-editor";
import { DDeiCoreStandLayout } from "ddei-editor";
import { DDeiCoreBottomMenuPanel } from "ddei-editor"; 


const options = {
  config: { 
    "grid": 0, //网格线
    "background": { color: "blue", opacity: 0.1 }, //背景色
    GLOBAL_ALLOW_OPEN_MULT_LAYERS:true, //允许多图层编辑(默认开启)
    initData: {
      controls: [
        {
          model: "102010",
          text: "初始化图形",
        }
      ]
    }
  },
  //配置扩展插件
  extensions: [
    //布局的配置
    DDeiCoreStandLayout.configuration({
      //配置插件
      'top': [],
      'middle': ['ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],
      'bottom': [], 
      'left': [],
      'right': []
    }),
    //底部菜单栏的配置,只保留图层管理按钮
    DDeiCoreBottomMenuPanel.configuration({
      'panels': ["ddei-core-panel-bottom-managelayers"]
    })
  ],
}
</script>

<template>
  <div style="width:400px;height:400px;margin:100px auto;">
    <DDeiEditorView :options="options" id="ddei_editor_1"></DDeiEditorView>
  </div>
</template>

实时效果

技术支持