import deviceType from '../config/deviceType'; import Link from './Link'; import Section from './section'; import Signal from './Signal'; /** 图库*/ const mapShape = {}; mapShape[deviceType.Link] = Link; mapShape[deviceType.Section] = Section; mapShape[deviceType.Signal] = Signal; function shapefactory(type, device, style) { const shape = mapShape[type]; if (shape instanceof Function) { return new shape(device, style[type]); } } export default shapefactory;