当前位置: 首页 > news >正文

DDei在线设计器-HTML渲染

Html渲染

  HtmlViewer插件通过将一个外部DIV附着在图形控件上,从而改变原有图形的显示方式。允许使用者自己定义HTML通过HTML元素。本示例演示了通过Html来扩展渲染图形,从而获得更加丰富的图形展现。

  通常情况下,我们创建的图形控件,如下图所示:
在这里插入图片描述

  通过HtmlViewer插件,我们可以使用表现力更强的HTML元素来替换显示的图形,或者结合业务需要,将一些业务数据显示在图形上,如下:
在这里插入图片描述

  本篇最后提供的示例可以在DDei文档直接预览。

一、HTML渲染

ReplaceDivDemo.vue 渲染模板

<script lang="ts">
export default {name: "replace-div-demo",props: {type: {type: String,default: null},name: {type: String,default: null},matchField:{type: String,default: null},editor:{type:Object,default:null}},mounted() {let field = this.matchField;this.editor.renderViewerIns[this[field]] = this.$refs['divElement']}
};
</script>
<template><div ref="divElement"style="display: flex;flex-direction:column;text-align:center;align-items: center;background: white;color:black;display: none;"><div style="width:100%;display: flex;text-align:center;align-items: center;"><div style="flex:1">代码</div><div style="flex:1">{{ type }}</div></div><div style="width:100%;display: flex;text-align:center;align-items: center;"><div style="flex:1">名称</div><div style="flex:1">{{ name }}</div></div></div>
</template>

demo.vue

<script setup lang="ts">
import DDeiEditorView from "ddei-editor";
import { DDeiCoreStandLayout } from "ddei-editor";
import { DDeiExtHtmlViewer } from "ddei-editor"; // [!code ++]
import ReplaceDivDemo from "./ReplaceDivDemo.vue" // [!code ++] const options = {config: { initData: {//初始化图形控件,type为扩展属性,用来匹配DDeiExtHtmlViewer的matchFieldcontrols: [ {id: "act_1",model: "102010",type: "emp_1",  // [!code ++]text: "第一步",border:{color:"yellow",dash:[10,10,5,5],width:5},fill:{color:"grey"},},{id: "act_2",model: "102010",type: "emp_2",  // [!code ++]width: 200,height: 100,text: "第二步",offsetY: -70,}]}},//配置扩展插件extensions: [//布局的配置DDeiCoreStandLayout.configuration({//配置插件'top': [],'middle': ['ddei-core-panel-canvasview', 'ddei-core-panel-quickcolorview'],'bottom':[],'left': [],'right': []}),//配置htmlviewer插件,matchField用于声明图形控件中的属性与config中的key对应字段  // [!code ++:19]DDeiExtHtmlViewer.configuration({matchField: "type", //匹配字段"emp_1": {          //key-valuetype: "emp_1",name: "张三",viewer: ReplaceDivDemo  //HTML模板控件},"emp_2": {type: "emp_2",name: "李四",viewer: ReplaceDivDemo},"emp_3": {type: "emp_3",name: "王五",viewer: ReplaceDivDemo}})],
}
</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

文档: http://docs.ddei.top

在线体验: https://www.ddei.top

http://www.lryc.cn/news/403150.html

相关文章:

  • 【React Hooks原理 - useSyncExternalStore】
  • C++STL初阶(7):list的运用与初步了解
  • el-menu弹出菜单样式不生效
  • Springboot 3.x - Reactive programming (2)
  • WPF+Mvvm 项目入门完整教程(一)
  • [解决方法]git上传的项目markdown文件的图片无法显示
  • 【React】使用 antd 加载组件实现 iframe 的加载效果
  • Python爬虫(1) --基础知识
  • 云原生系列 - Jenkins
  • django踩坑(四):终端输入脚本可正常执行,而加入crontab中无任何输出
  • 计算机网络入门 -- 常用网络协议
  • 【LabVIEW作业篇 - 4】:属性节点赋值和直接节点赋值的区别体现
  • 【数据库系列】Parquet 文件介绍
  • A Survey on Multimodal Large Language Models综述
  • Leetcode3208. 交替组 II
  • 汇编教程2
  • 使用 git 和 GitHub 互动
  • 【Spring Boot 中的 `banner.txt` 和 `logback-spring.xml` 配置】
  • Python Linux环境(Centos8)安装minicoda3+jupyterlab
  • Python PDF Magic:合并和拆分随心所欲
  • Gmsh应用程序编程接口
  • DP 203 学习笔记
  • SQLite 事务
  • LabVIEW和Alicat Scientific质量流量计实现精确流量控制
  • 2024-07-19 Unity插件 Odin Inspector10 —— Misc Attributes
  • Go操作Redis详解
  • 钡铼Modbus TCP耦合器BL200实现现场设备与SCADA无缝对接
  • 数据分析入门:用Python和Numpy探索音乐流行趋势
  • 数仓工具—Hive语法之替换函数和示例
  • [SUCTF 2019]EasySQL1