正式环境展示¶
图纸渲染¶
画好图纸后,只需要将编辑器生成的 JSON 信息存入后台数据库或文件管理系统,并根据要求写好接口,将图纸信息返回给渲染组件即可。
使用 preview 组件加载图纸:
<template>
<preview
:svgId="id"
:webtopoAPI="webtopoAPI"
:isConnect="isConnect"
ref="preview"
@register="register"
></preview>
</template>
数据推送¶
数据推送和点位注册不限制技术,可以使用 Socket 也可以使用轮询等技术。
只需要记住两个组件方法:
this.$refs.preview.getPointList() // 获取图纸所有点位信息
this.$refs.preview.changeData(data) // 将获取到的数据发送给组件
具体 Socket 接入示例请参阅 数据推送。