222
schangxiang@126.com
2025-04-30 9bec4dcae002f36aa23231da11cb03a156b40110
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { HtmlNodeModel, HtmlNode } from '@logicflow/core'
import { h, createApp } from 'vue'
import BaseNode from './BaseNode'
import { NODES } from '../../core/enum'
 
class StartModel extends HtmlNodeModel {
  setAttributes() {
    this.text.editable = false
    const width = 120
    const height = 36
    this.width = width
    this.height = height
    this.anchorsOffset = [
      // [width / 2, 0],//右边
      [0, height / 2], //下边
      // [-width / 2, 0],
      // [0, -height / 2], //上边
    ]
  }
}
 
class StartNode extends HtmlNode {
  [key: string]: any
  constructor(props: any) {
    super(props)
    this.app = createApp(() => {
      const { properties } = this.props.model
      return (
        <BaseNode
          width="116px"
          height="30px"
          borderColor="rgb(146, 101, 243)"
          icon="start"
          node={properties}
          background="#fff"
          color="#333"
        />
      )
    })
  }
 
  setHtml(rootEl: HTMLElement) {
    const dom = document.createElement('div')
    rootEl.appendChild(dom)
    this.app.mount(dom)
  }
}
 
export default {
  type: NODES.ACTIVITY,
  view: StartNode,
  model: StartModel,
}