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
| <template>
| <div v-show="visible"
| class="gantt-markline"
| :style="{'background-color':color,'left':getPosition()+'px'}">
| <div class="gantt-markline-label"
| :style="{'background-color':color}">{{dayjs(markLineTime).format("HH:mm:ss")}}</div>
| </div>
| </template>
|
| <script>
| import dayjs from "dayjs";
| export default {
| name: "MarkLine",
| props: {
| markLineTime: {
| validator(date) {
| return dayjs(date).isValid();
| }
| },
| color: {
| type: String,
| default: "#00a79d"
| },
| getPositonOffset: {
| type: Function,
| required: true
| }
| },
| data() {
| return {
| visible: false,
| dayjs:dayjs
| };
| },
| methods: {
| getPosition() {
| if (this.markLineTime == null) {
| this.visible = false;
| return 0;
| } else {
| this.visible = true;
| return this.getPositonOffset(this.markLineTime);
| }
| }
| }
| };
| </script>
|
|