1
1
<template >
2
2
<div class =" guides" v-show =" moving" >
3
3
<!-- 横线 -->
4
- <div class =" horiz" :key =" val + i " v-for =" ( val, i) in horiz"
5
- :style =" {top: val + 'px'}"
6
- v-show =" attachHoriz(val)" ></div >
4
+ <div class =" horiz" :key =" val.id " v-for =" val in horiz"
5
+ :style =" {top: val.val + 'px'}"
6
+ v-show =" attachHoriz(val.val )" ></div >
7
7
8
8
<!-- 竖线 -->
9
- <div class =" verti" :key =" val + i " v-for =" ( val, i) in verti"
10
- :style =" {left: val + 'px'}"
11
- v-show =" attachVerti(val)" ></div >
9
+ <div class =" verti" :key =" val.id " v-for =" val in verti"
10
+ :style =" {left: val.val + 'px'}"
11
+ v-show =" attachVerti(val.val )" ></div >
12
12
</div >
13
13
</template >
14
14
@@ -40,6 +40,7 @@ export default {
40
40
if (item .hasGuide && item .belong !== ' page' ) return
41
41
42
42
guides .push ({
43
+ uuid: item .uuid ,
43
44
width: item .width ,
44
45
height: item .height ,
45
46
top: item .top ,
@@ -66,10 +67,16 @@ export default {
66
67
var bottom = top + val .height
67
68
68
69
if (cor .indexOf (top) < 0 && top !== 0 ) {
69
- cor .push (top)
70
+ cor .push ({
71
+ id: ` horiz-${ val .uuid } -${ top} ` ,
72
+ val: top
73
+ })
70
74
}
71
75
if (cor .indexOf (bottom) < 0 ) {
72
- cor .push (bottom)
76
+ cor .push ({
77
+ id: ` horiz-${ val .uuid } -${ bottom} ` ,
78
+ val: bottom
79
+ })
73
80
}
74
81
})
75
82
@@ -85,10 +92,16 @@ export default {
85
92
var right = left + val .width
86
93
87
94
if (cor .indexOf (left) < 0 && left !== 0 ) {
88
- cor .push (left)
95
+ cor .push ({
96
+ id: ` verti-${ val .uuid } -${ left} ` ,
97
+ val: left
98
+ })
89
99
}
90
100
if (cor .indexOf (right) < 0 && right < 750 ) {
91
- cor .push (right)
101
+ cor .push ({
102
+ id: ` verti-${ val .uuid } -${ right} ` ,
103
+ val: right
104
+ })
92
105
}
93
106
})
94
107
0 commit comments