bpmn.js中的modeling如何获取
时间: 2024-06-13 22:07:30 浏览: 134
根据提供的引用内容,可以得知获取bpmn.js中的modeling有两种方式:继承和重新实现。如果选择继承,可以通过以下代码获取modeling:
```javascript
import BpmnModeler from 'bpmn-js/lib/Modeler';
import inherits from 'inherits';
function CustomModeler(options) {
BpmnModeler.call(this, options);
}
inherits(CustomModeler, BpmnModeler);
CustomModeler.prototype._interactionModules = [
// ...
];
CustomModeler.prototype._modelingModules = [
// ...
];
CustomModeler.prototype._modules = [].concat(
CustomModeler.prototype._modules,
CustomModeler.prototype._interactionModules,
CustomModeler.prototype._modelingModules
);
export default CustomModeler;
```
如果选择重新实现,可以通过以下代码获取modeling:
```javascript
import BpmnModeler from 'bpmn-js/lib/Modeler';
import CustomModeling from './CustomModeling';
function CustomModeler(options) {
BpmnModeler.call(this, options);
this.modeling = new CustomModeling(this);
}
CustomModeler.prototype = Object.create(BpmnModeler.prototype);
CustomModeler.prototype.constructor = CustomModeler;
export default CustomModeler;
```
阅读全文