|
2 | 2 | import { ref } from 'vue'
|
3 | 3 | import LogicFlow from '@logicflow/core'
|
4 | 4 | import '@logicflow/core/dist/style/index.css'
|
| 5 | +import Palette from './Palette.vue' |
| 6 | +import FunctionNode from './nodes/FunctionNode' |
5 | 7 |
|
6 | 8 | export default {
|
7 | | - props: { |
8 | | - msg: String |
9 | | - }, |
10 | 9 | setup() {
|
11 | 10 | const count = ref(0)
|
12 | 11 | return {
|
13 | 12 | count
|
14 | 13 | }
|
15 | 14 | },
|
16 | 15 | mounted() {
|
17 | | - console.log(44, this.count) |
18 | 16 | this.lf = new LogicFlow({
|
19 | 17 | container: this.$refs.container,
|
20 | | - grid: true |
| 18 | + grid: { |
| 19 | + visible: true, |
| 20 | + type: 'mesh', |
| 21 | + config: { |
| 22 | + color: '#eeeeee' |
| 23 | + } |
| 24 | + } |
| 25 | + }) |
| 26 | + console.log(FunctionNode) |
| 27 | + this.lf.register(FunctionNode) |
| 28 | + this.lf.render({ |
| 29 | + nodes: [ |
| 30 | + { |
| 31 | + id: 'id1', |
| 32 | + type: 'function-node', |
| 33 | + x: 350, |
| 34 | + y: 150, |
| 35 | + properties: { |
| 36 | + name: '1', |
| 37 | + color: 'red', |
| 38 | + forms: [] |
| 39 | + }, |
| 40 | + text: { |
| 41 | + x: 365, |
| 42 | + y: 152, |
| 43 | + value: '开始节点' |
| 44 | + } |
| 45 | + }] |
21 | 46 | })
|
22 | | - this.lf.render() |
| 47 | + }, |
| 48 | + methods: { |
| 49 | + setProperties () { |
| 50 | + this.lf.setProperties('id1', { |
| 51 | + color: 'green', |
| 52 | + }) |
| 53 | + } |
| 54 | + }, |
| 55 | + components: { |
| 56 | + Palette |
23 | 57 | }
|
24 | 58 | }
|
25 | 59 | </script>
|
26 | 60 |
|
27 | 61 | <template>
|
28 | | - <div ref="container" class="container"></div> |
| 62 | + <div class="flow-chart"> |
| 63 | + <div ref="container" class="container"></div> |
| 64 | + <Palette class="flow-chart-palette"> |
| 65 | + <button @click="setProperties">11</button> |
| 66 | + </Palette> |
| 67 | + </div> |
29 | 68 | </template>
|
30 | 69 |
|
31 | 70 | <style scoped>
|
32 | 71 | .container {
|
33 | 72 | width: 100%;
|
34 | 73 | height: 100%;
|
35 | 74 | }
|
| 75 | +.flow-chart { |
| 76 | + position: relative; |
| 77 | + width: 100%; |
| 78 | + height: 100%; |
| 79 | +} |
| 80 | +.flow-chart-palette { |
| 81 | + position: absolute; |
| 82 | + left: 0; |
| 83 | + top: 0; |
| 84 | + z-index: 1; |
| 85 | +} |
36 | 86 | </style>
|
0 commit comments