kui-vue 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/components/affix/affix.jsx +23 -75
  2. package/components/affix/demo/container.md +14 -7
  3. package/components/affix/index.md +7 -5
  4. package/components/alert/styles/index.less +13 -8
  5. package/components/avatar/avatar.jsx +63 -0
  6. package/components/avatar/demo/base.md +24 -0
  7. package/components/avatar/demo/change.md +40 -0
  8. package/components/avatar/demo/index.vue +20 -0
  9. package/components/avatar/demo/info.md +7 -0
  10. package/components/avatar/demo/types.md +23 -0
  11. package/components/avatar/index.js +2 -0
  12. package/components/avatar/index.md +7 -0
  13. package/components/avatar/styles/index.less +61 -0
  14. package/components/badge/styles/index.less +1 -2
  15. package/components/base/pop.jsx +1 -1
  16. package/components/breadcrumb/styles/index.less +2 -2
  17. package/components/button/demo/hollow.md +1 -1
  18. package/components/button/styles/index.less +5 -5
  19. package/components/card/demo/border.md +1 -1
  20. package/components/card/styles/index.less +4 -3
  21. package/components/checkbox/checkbox.jsx +4 -2
  22. package/components/checkbox/styles/index.less +49 -44
  23. package/components/collapse/styles/index.less +3 -10
  24. package/components/colorPicker/styles/index.less +5 -3
  25. package/components/datePicker/styles/calendar.less +6 -5
  26. package/components/datePicker/styles/datepicker.less +3 -3
  27. package/components/divider/styles/index.less +7 -6
  28. package/components/drawer/drawer.jsx +10 -8
  29. package/components/drawer/styles/index.less +2 -1
  30. package/components/dropdown/demo/rightmenu.md +2 -3
  31. package/components/dropdown/styles/index.less +2 -2
  32. package/components/empty/styles/index.less +1 -1
  33. package/components/form/styles/index.less +1 -0
  34. package/components/grid/demo/align.md +3 -3
  35. package/components/grid/demo/fill.md +3 -3
  36. package/components/grid/demo/flex.md +5 -5
  37. package/components/grid/demo/index.vue +0 -1
  38. package/components/icon/demo/search.vue +2 -2
  39. package/components/image/instance.js +1 -1
  40. package/components/image/preview.jsx +50 -20
  41. package/components/image/styles/index.less +7 -5
  42. package/components/index.js +7 -1
  43. package/components/input/styles/index.less +2 -1
  44. package/components/layout/demo/base.md +3 -4
  45. package/components/layout/demo/layout1.md +4 -4
  46. package/components/layout/demo/layout2.md +5 -6
  47. package/components/layout/demo/layout3.md +3 -4
  48. package/components/layout/demo/layout4.md +4 -4
  49. package/components/layout/demo/layout5.md +8 -8
  50. package/components/layout/demo/layout6.md +2 -2
  51. package/components/layout/styles/index.less +2 -3
  52. package/components/loading/styles/index.less +1 -1
  53. package/components/menu/styles/dropmenu.less +7 -6
  54. package/components/menu/styles/index.less +13 -9
  55. package/components/message/styles/index.less +1 -1
  56. package/components/modal/modal.jsx +10 -8
  57. package/components/modal/styles/index.less +7 -6
  58. package/components/notice/styles/index.less +1 -1
  59. package/components/page/styles/index.less +1 -1
  60. package/components/popconfirm/styles/index.less +3 -2
  61. package/components/poptip/styles/index.less +4 -3
  62. package/components/progress/styles/index.less +3 -3
  63. package/components/radio/radio.jsx +3 -5
  64. package/components/radio/styles/index.less +60 -55
  65. package/components/rate/index.md +3 -3
  66. package/components/rate/styles/index.less +1 -1
  67. package/components/select/styles/index.less +8 -7
  68. package/components/slider/demo/base.md +35 -0
  69. package/components/slider/demo/index.vue +18 -0
  70. package/components/slider/demo/info.md +7 -0
  71. package/components/slider/demo/vertical.md +13 -0
  72. package/components/slider/index.md +7 -0
  73. package/components/slider/slider.jsx +58 -0
  74. package/components/slider/styles/index.less +60 -32
  75. package/components/space/demo/align.md +46 -0
  76. package/components/space/demo/base.md +20 -0
  77. package/components/space/demo/custom-size.md +35 -0
  78. package/components/space/demo/index.vue +25 -0
  79. package/components/space/demo/info.md +11 -0
  80. package/components/space/demo/size.md +35 -0
  81. package/components/space/demo/vertical.md +19 -0
  82. package/components/space/index.js +2 -0
  83. package/components/space/index.md +6 -0
  84. package/components/space/space.jsx +57 -0
  85. package/components/space/styles/index.less +23 -0
  86. package/components/spin/demo/container.md +1 -2
  87. package/components/spin/demo/mode.md +1 -2
  88. package/components/spin/styles/index.less +1 -1
  89. package/components/styles/dark.less +70 -0
  90. package/components/styles/global-dark.less +36 -0
  91. package/components/styles/global.less +22 -12
  92. package/components/styles/index.less +8 -10
  93. package/components/switch/styles/index.less +4 -3
  94. package/components/table/demo/base-render.md +1 -1
  95. package/components/table/demo/base.md +5 -2
  96. package/components/table/styles/index.less +11 -7
  97. package/components/table/table.jsx +10 -7
  98. package/components/tabs/demo/sample.md +1 -1
  99. package/components/tabs/styles/index.less +7 -10
  100. package/components/tag/styles/index.less +40 -39
  101. package/components/timeline/styles/index.less +3 -2
  102. package/components/tooltip/styles/index.less +22 -3
  103. package/components/tree/styles/index.less +8 -8
  104. package/dist/k-ui-dark.css +1 -0
  105. package/dist/k-ui.css +1 -7
  106. package/dist/k-ui.js +2 -2
  107. package/package.json +11 -9
  108. package/components/slider/demo/slider.js +0 -5
  109. package/components/slider/slider.vue +0 -21
  110. package/components/slider/sliderButton.vue +0 -76
  111. package/components/styles.js +0 -43
@@ -5,6 +5,8 @@
5
5
  display: inline-block;
6
6
  user-select: none;
7
7
  line-height: 1;
8
+ color: @color;
9
+ // margin-right: 16px;
8
10
  .k-checkbox {
9
11
  display: inline-block;
10
12
  vertical-align: middle;
@@ -16,52 +18,45 @@
16
18
  margin: 0;
17
19
  box-sizing: content-box;
18
20
  font-size: 0;
19
- .k-checkbox-inner {
20
- box-sizing: content-box;
21
- display: inline-block;
22
- width: 14px;
23
- height: 14px;
24
- position: relative;
25
- top: 0;
26
- left: 0;
27
- border: 1px solid @border-color;
28
- border-radius: 2px;
29
- background-color: #fff;
30
- transition: border-color .2s ease-in-out, background-color .2s ease-in-out;
31
- overflow: hidden;
32
- color: #fff;
33
- .k-icon {
34
- font-size: 18px;
35
- position: absolute;
36
- left: 50%;
37
- top: 50%;
38
- transform: translate3d(-50%, -50%, 0);
39
- }
40
- }
41
- .k-checkbox-input {
42
- width: 100%;
43
- height: 100%;
21
+ }
22
+ .k-checkbox-inner {
23
+ box-sizing: content-box;
24
+ display: inline-block;
25
+ width: 14px;
26
+ height: 14px;
27
+ position: relative;
28
+ top: 0;
29
+ left: 0;
30
+ border: 1px solid @border-color;
31
+ border-radius: 2px;
32
+ background-color: @back-color;
33
+ transition: border-color .2s ease-in-out, background-color .2s ease-in-out;
34
+ overflow: hidden;
35
+ color: @back-color;
36
+ .k-icon {
37
+ font-size: 18px;
44
38
  position: absolute;
45
- top: 0;
46
- bottom: 0;
47
- left: 0;
48
- right: 0;
49
- z-index: 1;
50
- cursor: pointer;
51
- opacity: 0;
52
- &:focus {
53
- +.k-checkbox-inner {
54
- border: 1px solid @main;
55
- box-shadow: 0 0 5px fade(@main, 75%);
56
- }
57
- }
39
+ left: 50%;
40
+ top: 50%;
41
+ transform: translate3d(-50%, -50%, 0);
58
42
  }
59
43
  }
60
- .k-checkbox-checked {
61
- .k-checkbox-inner {
62
- background: @main;
63
- border-color: @main;
64
- position: relative;
44
+ .k-checkbox-input {
45
+ width: 100%;
46
+ height: 100%;
47
+ position: absolute;
48
+ top: 0;
49
+ bottom: 0;
50
+ left: 0;
51
+ right: 0;
52
+ z-index: 1;
53
+ cursor: pointer;
54
+ opacity: 0;
55
+ &:focus {
56
+ +.k-checkbox-inner {
57
+ border: 1px solid @main;
58
+ box-shadow: 0 0 5px fade(@main, 75%);
59
+ }
65
60
  }
66
61
  }
67
62
  .k-checkbox-indeterminate {
@@ -88,11 +83,18 @@
88
83
  border-color: @main;
89
84
  }
90
85
  .k-checkbox-label {
91
- padding: 0 8px;
86
+ padding-left: 8px;
92
87
  vertical-align: middle;
93
88
  }
94
89
  }
95
90
 
91
+ .k-checkbox-checked {
92
+ .k-checkbox-inner {
93
+ background: @main;
94
+ border-color: @main;
95
+ }
96
+ }
97
+
96
98
  .k-checkbox-disabled {
97
99
  cursor: not-allowed;
98
100
  color: @disable-color;
@@ -117,4 +119,7 @@
117
119
 
118
120
  .k-checkbox-group {
119
121
  display: inline-block;
122
+ .k-checkbox-wrapper {
123
+ margin-right: 16px;
124
+ }
120
125
  }
@@ -5,6 +5,7 @@
5
5
  border-radius: @radius;
6
6
  border-bottom: 0;
7
7
  overflow: hidden;
8
+ color: @color;
8
9
  &>.k-collapse-item {
9
10
  border-bottom: 1px solid @border-color;
10
11
  &>.k-collapse-header {
@@ -29,7 +30,7 @@
29
30
  }
30
31
  }
31
32
  .k-collapse-content {
32
- background-color: #fff;
33
+ // background-color: #fff;
33
34
  border-top: 1px solid @border-color;
34
35
  padding: 0 16px;
35
36
  transition: all .3s ease-in-out;
@@ -51,7 +52,7 @@
51
52
  border: none;
52
53
  background: none;
53
54
  .k-collapse-item {
54
- background: @light;
55
+ background: fadeout(@border-color, 60%);
55
56
  border: none;
56
57
  margin-bottom: 10px;
57
58
  border-radius: @radius;
@@ -63,14 +64,6 @@
63
64
  }
64
65
  }
65
66
 
66
- .k-alert-info {
67
- background: tint(@main, 90%);
68
- border-color: tint(@main, 70%);
69
- .k-alert-icon {
70
- color: @main;
71
- }
72
- }
73
-
74
67
  .k-collaplse-slide-enter-active {
75
68
  animation: slideIn 0.3s ease-in-out;
76
69
  animation-fill-mode: both;
@@ -70,13 +70,14 @@
70
70
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
71
71
  position: absolute;
72
72
  border-radius: @radius;
73
- background: #fff;
73
+ background: @back-color;
74
74
  .k-color-picker-paint-dot {
75
75
  width: 15px;
76
76
  height: 15px;
77
77
  display: block;
78
78
  position: absolute;
79
- background: #fff;
79
+ background: @back-color;
80
+ border:1px solid @border-color;
80
81
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
81
82
  border-radius: 50%;
82
83
  top: 10px;
@@ -126,7 +127,8 @@
126
127
  height: 15px;
127
128
  display: block;
128
129
  position: absolute;
129
- background: #fff;
130
+ background: @back-color;
131
+ border:1px solid @border-color;
130
132
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
131
133
  border-radius: 50%;
132
134
  pointer-events: none;
@@ -3,6 +3,7 @@
3
3
  display: inline-block;
4
4
  user-select: none;
5
5
  float: left;
6
+ color: @color;
6
7
  // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
7
8
  &+.k-calendar {
8
9
  // border-left: solid 1px #eaeaea;
@@ -83,7 +84,7 @@
83
84
  width: 100%;
84
85
  height: 100%;
85
86
  position: absolute;
86
- background: #fff;
87
+ background: @back-color;
87
88
  left: 0;
88
89
  top: 0;
89
90
  font-size: 0;
@@ -183,8 +184,8 @@
183
184
  height: 100%;
184
185
  left: 0;
185
186
  top: 0;
186
- background: #fff;
187
- border-top: 1px solid @border-color;
187
+ background: @back-color;
188
+ border-top: 1px solid darken(@border-color,10%);
188
189
  .k-calendar-time-picker-select {
189
190
  width: 33.333%;
190
191
  font-size: 0;
@@ -214,7 +215,7 @@
214
215
  list-style: none;
215
216
  cursor: pointer;
216
217
  &:hover {
217
- background: @light ;
218
+ background: fadeout(@main, 90%);
218
219
  }
219
220
  &:last-child::after {
220
221
  display: block;
@@ -234,7 +235,7 @@
234
235
  .k-calendar-time-selected {
235
236
  color: @main;
236
237
  font-weight: bold;
237
- background: @light;
238
+ background: darken(@back-color,5%);
238
239
  }
239
240
  }
240
241
  }
@@ -5,8 +5,8 @@
5
5
  max-width: 100%;
6
6
  box-sizing: border-box;
7
7
  vertical-align: middle;
8
- color: #495060;
9
- background: #fff;
8
+ color: @color;
9
+ background: transparent;
10
10
  font-size: 12px;
11
11
  position: relative;
12
12
  border: 1px solid @border-color;
@@ -94,7 +94,7 @@
94
94
  .k-datepicker-dropdown {
95
95
  position: absolute;
96
96
  z-index: 1003;
97
- background: #fff;
97
+ background: @back-color;
98
98
  }
99
99
 
100
100
  .k-datepicker-sm {
@@ -1,4 +1,4 @@
1
- @border: #e8e8e8;
1
+ @import '../../styles/global.less';
2
2
  .k-divider {
3
3
  box-sizing: border-box;
4
4
  margin: 0;
@@ -7,10 +7,10 @@
7
7
  font-size: 14px;
8
8
  line-height: 1.5;
9
9
  list-style: none;
10
- background: @border;
10
+ background: @border-color;
11
11
  &-dashed {
12
12
  background: none;
13
- border: dashed @border;
13
+ border: dashed @border-color;
14
14
  border-width: 1px 0 0
15
15
  }
16
16
  &, &-vertical {
@@ -24,11 +24,12 @@
24
24
  }
25
25
  .k-divider-inner-text {
26
26
  display: inline-block;
27
- padding: 0 10px
27
+ padding: 0 10px;
28
+ color: @color;
28
29
  }
29
30
  &-dashed {
30
31
  background: none;
31
- border: dashed @border;
32
+ border: dashed @border-color;
32
33
  border-width: 1px 0 0;
33
34
  }
34
35
  &-vertical {
@@ -57,7 +58,7 @@
57
58
  top: 50%;
58
59
  display: table-cell;
59
60
  width: 50%;
60
- border-top: 1px solid @border;
61
+ border-top: 1px solid @border-color;
61
62
  transform: translateY(50%);
62
63
  content: ""
63
64
  }
@@ -65,24 +65,26 @@ export default {
65
65
  }
66
66
  },
67
67
  resetBodyStyle(opened) {
68
+ let target = this.target();
68
69
  if (!this.visible && !cacheBodyOverflow.hasOwnProperty('overflow')) {
69
70
  cacheBodyOverflow = {
70
- width: document.body.width,
71
- overflow: document.body.overflow,
72
- overflowX: document.body.overflowX,
73
- overflowY: document.body.overflowY,
71
+ width: target.width,
72
+ overflow: target.overflow,
73
+ overflowX: target.overflowX,
74
+ overflowY: target.overflowY,
74
75
  }
75
76
  }
76
77
  if (opened) {
77
78
  let barWidth = measureScrollBar(true)
78
- if (barWidth) {
79
- document.body.style.width = `calc(100% - ${barWidth}px)`
80
- document.body.style.overflow = `hidden`
79
+ let hasBar = target.scrollHeight > target.clientHeight || target.offsetHeight > target.clientHeight
80
+ if (barWidth && hasBar) {
81
+ target.style.width = `calc(100% - ${barWidth}px)`
82
+ target.style.overflow = `hidden`
81
83
  }
82
84
  } else {
83
85
  setTimeout(() => {
84
86
  Object.keys(cacheBodyOverflow).forEach(key => {
85
- document.body.style[key] = cacheBodyOverflow[key] || ''
87
+ target.style[key] = cacheBodyOverflow[key] || ''
86
88
  delete cacheBodyOverflow[key]
87
89
  })
88
90
  }, 300)
@@ -23,7 +23,7 @@
23
23
  }
24
24
  .k-drawer-content {
25
25
  position: relative;
26
- background-color: #fff;
26
+ background-color: @back-color;
27
27
  border: 0;
28
28
  background-clip: padding-box;
29
29
  height: 100%;
@@ -66,6 +66,7 @@
66
66
  height: calc(100% - 43px);
67
67
  overflow: auto;
68
68
  box-sizing: border-box;
69
+ color:@color;
69
70
  }
70
71
  .k-drawer-footer {
71
72
  border-top: 1px solid @border-color;
@@ -7,12 +7,11 @@
7
7
  <template>
8
8
  <Dropdown trigger="contextmenu" @click="handle">
9
9
  <div :style="{
10
- textAlign: 'center',
11
- background: '#f5f5f5',
10
+ textAlign: 'center',
12
11
  height: '200px',
13
12
  lineHeight: '200px',
14
13
  color: '#999',
15
- }">Right Click on here</div>
14
+ }" class="demo-back">Right Click on here</div>
16
15
  <Menu slot="content">
17
16
  <MenuItem key="news">New file</MenuItem>
18
17
  <MenuItem key="edit">Edit</MenuItem>
@@ -5,7 +5,7 @@
5
5
  position: absolute;
6
6
  z-index: 1001;
7
7
  .k-dropdown-inner {
8
- background: #fff;
8
+ background: @back-color;
9
9
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
10
10
  border-radius: @radius;
11
11
  .k-dropdown-menu {
@@ -21,7 +21,7 @@
21
21
  align-items: center;
22
22
  width: 19px;
23
23
  .k-dropdown-arrow-content {
24
- background-color: #fff;
24
+ background-color: @back-color;
25
25
  transform: rotate(45deg);
26
26
  width: 12px;
27
27
  height: 12px;
@@ -1,7 +1,7 @@
1
1
  @import '../../styles/global.less';
2
2
  .k-empty {
3
3
  text-align: center;
4
- color: @border-color;
4
+ color: fadeout(@color,50%);
5
5
  font-size: 13px;
6
6
  // cursor: not-allowed;
7
7
  .k-empty-icon {
@@ -4,6 +4,7 @@
4
4
  margin-bottom: 24px;
5
5
  vertical-align: top;
6
6
  zoom: 1;
7
+ color: @color;
7
8
  // margin-bottom: 5px;
8
9
  &::before, &::after {
9
10
  content: '';
@@ -7,21 +7,21 @@ Flex 子元素垂直对齐。
7
7
  <template>
8
8
  <div class="demo-grid">
9
9
  <p>Align Top</p>
10
- <Row type="flex" align="top" justify="space-around">
10
+ <Row type="flex" align="top" justify="space-around" class="demo-back">
11
11
  <Col :span="4"><div class="h-96">col-4</div></Col>
12
12
  <Col :span="4"><div class="h-64">col-4</div></Col>
13
13
  <Col :span="4"><div class="h-128">col-4</div></Col>
14
14
  <Col :span="4"><div class="h-72">col-4</div></Col>
15
15
  </Row>
16
16
  <p>Align Middle</p>
17
- <Row type="flex" align="middle" justify="space-around">
17
+ <Row type="flex" align="middle" justify="space-around" class="demo-back">
18
18
  <Col :span="4"><div class="h-96">col-4</div></Col>
19
19
  <Col :span="4"><div class="h-64">col-4</div></Col>
20
20
  <Col :span="4"><div class="h-128">col-4</div></Col>
21
21
  <Col :span="4"><div class="h-72">col-4</div></Col>
22
22
  </Row>
23
23
  <p>Align Bottom</p>
24
- <Row type="flex" align="bottom" justify="space-around">
24
+ <Row type="flex" align="bottom" justify="space-around" class="demo-back">
25
25
  <Col :span="4"><div class="h-96">col-4</div></Col>
26
26
  <Col :span="4"><div class="h-64">col-4</div></Col>
27
27
  <Col :span="4"><div class="h-128">col-4</div></Col>
@@ -7,17 +7,17 @@ Col 提供 flex 属性以支持填充。
7
7
  <template>
8
8
  <div class="demo-grid">
9
9
  <p>Percentage columns</p>
10
- <Row type="flex">
10
+ <Row type="flex" class="demo-back">
11
11
  <Col :flex="3"><div>3/8</div></Col>
12
12
  <Col :flex="5"><div>5/8</div></Col>
13
13
  </Row>
14
14
  <p>Fill rest</p>
15
- <Row type="flex">
15
+ <Row type="flex" class="demo-back">
16
16
  <Col flex="100px"><div>100px</div></Col>
17
17
  <Col flex="auto"><div>auto</div></Col>
18
18
  </Row>
19
19
  <p>Raw flex style</p>
20
- <Row type="flex">
20
+ <Row type="flex" class="demo-back">
21
21
  <Col flex="1 1 128px"><div>1 1 128px</div></Col>
22
22
  <Col flex="0 1 256px"><div>0 1 256px</div></Col>
23
23
  </Row>
@@ -8,35 +8,35 @@ Flex 布局基础。
8
8
  <template>
9
9
  <div class="demo-grid">
10
10
  <p>start</p>
11
- <Row type="flex" justify="start">
11
+ <Row type="flex" justify="start" class="demo-back">
12
12
  <Col :span="4"><div>col-4</div></Col>
13
13
  <Col :span="4"><div>col-4</div></Col>
14
14
  <Col :span="4"><div>col-4</div></Col>
15
15
  <Col :span="4"><div>col-4</div></Col>
16
16
  </Row>
17
17
  <p>center</p>
18
- <Row type="flex" justify="center">
18
+ <Row type="flex" justify="center" class="demo-back">
19
19
  <Col :span="4"><div>col-4</div></Col>
20
20
  <Col :span="4"><div>col-4</div></Col>
21
21
  <Col :span="4"><div>col-4</div></Col>
22
22
  <Col :span="4"><div>col-4</div></Col>
23
23
  </Row>
24
24
  <p>end</p>
25
- <Row type="flex" justify="end">
25
+ <Row type="flex" justify="end" class="demo-back">
26
26
  <Col :span="4"><div>col-4</div></Col>
27
27
  <Col :span="4"><div>col-4</div></Col>
28
28
  <Col :span="4"><div>col-4</div></Col>
29
29
  <Col :span="4"><div>col-4</div></Col>
30
30
  </Row>
31
31
  <p>space-around</p>
32
- <Row type="flex" justify="space-around">
32
+ <Row type="flex" justify="space-around" class="demo-back">
33
33
  <Col :span="4"><div>col-4</div></Col>
34
34
  <Col :span="4"><div>col-4</div></Col>
35
35
  <Col :span="4"><div>col-4</div></Col>
36
36
  <Col :span="4"><div>col-4</div></Col>
37
37
  </Row>
38
38
  <p>space-between</p>
39
- <Row type="flex" justify="space-between">
39
+ <Row type="flex" justify="space-between" class="demo-back">
40
40
  <Col :span="4"><div>col-4</div></Col>
41
41
  <Col :span="4"><div>col-4</div></Col>
42
42
  <Col :span="4"><div>col-4</div></Col>
@@ -44,7 +44,6 @@ export default {
44
44
  }
45
45
  .k-row-flex{
46
46
  padding: 10px 0;
47
- background: #f1f1f1;
48
47
  }
49
48
  .k-row {
50
49
  margin: 10px 0;
@@ -3,7 +3,7 @@
3
3
  <h3>图标快速检索</h3>
4
4
  <br />
5
5
  <Affix :offsetTop="52">
6
- <div style="background:#fff;padding:20px 0;">
6
+ <div style="padding:20px 0;" class="back">
7
7
  <div style="position:relative;width:800px;margin:0 auto;">
8
8
  <RadioGroup v-model="type" @change="switchIcon" style="position:absolute;right:4px;top:4px;z-index:10;">
9
9
  <RadioButton value="outline">Outline</RadioButton>
@@ -59,7 +59,7 @@
59
59
  transition: color 0.3s ease-in-out;
60
60
  &:hover {
61
61
  color: #3a95ff;
62
- background: #f5f5f5;
62
+ // background: #f5f5f5;
63
63
  box-shadow: 0 0 15px #ddd;
64
64
  }
65
65
  }
@@ -62,7 +62,7 @@ export default function createInstance({ type }) {
62
62
  },
63
63
  render() {
64
64
  let { src, visible, showSwitch, data, showPanel, slots, _globle, type } = this
65
- console.log(type)
65
+ // console.log(type)
66
66
  const imageProps = {
67
67
  props: {
68
68
  origin: src,
@@ -33,6 +33,7 @@ export default {
33
33
  vertical: true,
34
34
  isShowPanel: this.showPanel,
35
35
  panelRight: 0,
36
+ touch: false,
36
37
  }
37
38
  },
38
39
  watch: {
@@ -96,14 +97,29 @@ export default {
96
97
  this.$emit('input', false)
97
98
  this.$emit('close')
98
99
  },
100
+ touchstart(e) {
101
+ if (e.touches.length == 1 && this.$refs.imgRef && this.$refs.imgRef.contains(e.target)) {
102
+
103
+ }
104
+ },
99
105
  mousedown(e) {
100
- if (e.button == 0 && this.$refs.imgRef && this.$refs.imgRef.contains(e.target)) {
106
+ if (this.$refs.imgRef && this.$refs.imgRef.contains(e.target)) {
107
+ if (e.button && e.button != 0) return;
108
+ let clientX, clientY;
109
+ if (e.touches && e.touches.length == 1) {
110
+ clientX = e.touches[0].clientX
111
+ clientY = e.touches[0].clientY
112
+ } else {
113
+ clientX = e.clientX
114
+ clientY = e.clientY
115
+ }
101
116
  this.ismousedown = true
102
- this.startPos = { x: e.clientX, y: e.clientY }
103
- this.initPos = { x: e.clientX, y: e.clientY }
117
+ this.startPos = { x: clientX, y: clientY }
118
+ this.initPos = { x: clientX, y: clientY }
104
119
  this.mousemove(e)
105
- document.addEventListener('mousemove', this.mousemove)
106
- document.addEventListener('mouseup', this.mouseup)
120
+ let [e1, e2] = this.touch ? ['touchmove', 'touchend'] : ['mousemove', 'mouseup']
121
+ document.addEventListener(e1, this.mousemove, { passive: false })
122
+ document.addEventListener(e2, this.mouseup, { passive: false })
107
123
  }
108
124
  },
109
125
  resetPosition() {
@@ -144,16 +160,25 @@ export default {
144
160
  mouseup(e) {
145
161
  this.ismousedown = false
146
162
  this.resetPosition()
147
- document.removeEventListener('mousemove', this.mousemove)
148
- document.removeEventListener('mouseup', this.mouseup)
163
+ let [e1, e2] = this.touch ? ['touchmove', 'touchend'] : ['mousemove', 'mouseup']
164
+ document.removeEventListener(e1, this.mousemove)
165
+ document.removeEventListener(e2, this.mouseup)
149
166
  },
150
167
  mousemove(e) {
151
168
  if (this.ismousedown) {
152
- let { x, y } = this.startPos
153
- this.left += e.clientX - x
154
- this.top += e.clientY - y
155
- this.startPos = { x: e.clientX, y: e.clientY }
156
169
  e.preventDefault()
170
+ let clientX, clientY;
171
+ if (e.touches && e.touches.length == 1) {
172
+ clientX = e.touches[0].clientX
173
+ clientY = e.touches[0].clientY
174
+ } else {
175
+ clientX = e.clientX
176
+ clientY = e.clientY
177
+ }
178
+ let { x, y } = this.startPos
179
+ this.left += clientX - x
180
+ this.top += clientY - y
181
+ this.startPos = { x: clientX, y: clientY }
157
182
  }
158
183
  },
159
184
  switchImage(left) {
@@ -175,24 +200,26 @@ export default {
175
200
  }
176
201
  },
177
202
  resetBodyStyle(opened) {
203
+ let target = document.body
178
204
  if (!this.show && !cacheBodyOverflow.hasOwnProperty('overflow')) {
179
205
  cacheBodyOverflow = {
180
- width: document.body.width,
181
- overflow: document.body.overflow,
182
- overflowX: document.body.overflowX,
183
- overflowY: document.body.overflowY,
206
+ width: target.width,
207
+ overflow: target.overflow,
208
+ overflowX: target.overflowX,
209
+ overflowY: target.overflowY,
184
210
  }
185
211
  }
186
212
  if (opened) {
187
213
  let barWidth = measureScrollBar(true)
188
- if (barWidth) {
189
- document.body.style.width = `calc(100% - ${barWidth}px)`
190
- document.body.style.overflow = `hidden`
214
+ let hasBar = target.scrollHeight > target.clientHeight || target.offsetHeight > target.clientHeight
215
+ if (barWidth && hasBar) {
216
+ target.style.width = `calc(100% - ${barWidth}px)`
217
+ target.style.overflow = `hidden`
191
218
  }
192
219
  } else {
193
220
  setTimeout(() => {
194
221
  Object.keys(cacheBodyOverflow).forEach(key => {
195
- document.body.style[key] = cacheBodyOverflow[key] || ''
222
+ target.style[key] = cacheBodyOverflow[key] || ''
196
223
  delete cacheBodyOverflow[key]
197
224
  })
198
225
  }, 300)
@@ -216,7 +243,10 @@ export default {
216
243
  }
217
244
  },
218
245
  mounted() {
219
- document.addEventListener('mousedown', this.mousedown)
246
+ let touch = !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch)
247
+ this.touch = touch
248
+ let even = touch ? 'touchstart' : 'mousedown'
249
+ document.addEventListener(even, this.mousedown, { passive: false })
220
250
  },
221
251
  render(h) {
222
252
  const { scale, rotate, visible, src, left, top, transfer, showSwitch, data, loading, panelRight, type } = this