kui-vue 3.2.10 → 3.2.11
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.
- package/components/_tool/number.js +177 -0
- package/components/_tool/utils.js +9 -3
- package/components/base/input.jsx +82 -54
- package/components/base/pop.jsx +22 -8
- package/components/button/button.jsx +1 -1
- package/components/button/styles/index.less +6 -2
- package/components/checkbox/checkbox.jsx +6 -11
- package/components/checkbox/demo/check-all.md +6 -6
- package/components/checkbox/group.jsx +0 -1
- package/components/checkbox/styles/index.less +17 -11
- package/components/divider/styles/index.less +1 -1
- package/components/dropdown/demo/rightmenu.md +2 -2
- package/components/dropdown/styles/index.less +23 -34
- package/components/form/demo/base.md +7 -1
- package/components/form/demo/valid.md +13 -4
- package/components/form/styles/index.less +1 -5
- package/components/icon/demo/base.md +2 -2
- package/components/icon/demo/search.vue +31 -14
- package/components/icon/icon.jsx +3 -1
- package/components/icon/styles/index.less +1 -1
- package/components/index.js +2 -0
- package/components/input/demo/icon.md +2 -2
- package/components/input/demo/size.md +3 -3
- package/components/input/demo/suffix.md +13 -6
- package/components/input/demo/theme.md +11 -6
- package/components/input/index.md +2 -1
- package/components/input/input.jsx +5 -0
- package/components/input/styles/index.less +52 -63
- package/components/inputNumber/demo/base.md +34 -0
- package/components/inputNumber/demo/ffix.md +27 -0
- package/components/inputNumber/demo/format.md +80 -0
- package/components/inputNumber/demo/index.vue +23 -0
- package/components/inputNumber/demo/info.md +7 -0
- package/components/inputNumber/demo/size.md +18 -0
- package/components/inputNumber/index.js +2 -0
- package/components/inputNumber/index.md +16 -0
- package/components/inputNumber/inputNumber.jsx +169 -0
- package/components/inputNumber/styles/index.less +172 -0
- package/components/menu/demo/collapsed.md +1 -1
- package/components/menu/styles/dropmenu.less +2 -2
- package/components/menu/styles/index.less +31 -14
- package/components/message/demo/icon.md +33 -0
- package/components/message/demo/index.vue +2 -0
- package/components/message/index.md +9 -7
- package/components/message/inner.jsx +5 -3
- package/components/modal/modal.jsx +31 -31
- package/components/notice/demo/icon.md +27 -11
- package/components/notice/demo/index.vue +2 -0
- package/components/notice/demo/types.md +28 -0
- package/components/notice/index.js +3 -0
- package/components/notice/index.md +8 -6
- package/components/popconfirm/styles/index.less +64 -83
- package/components/poptip/demo/base.md +7 -0
- package/components/poptip/demo/placement.md +12 -13
- package/components/poptip/styles/index.less +60 -79
- package/components/progress/demo/circle.md +2 -2
- package/components/radio/button.jsx +4 -2
- package/components/radio/demo/button.md +32 -28
- package/components/radio/group.jsx +4 -2
- package/components/radio/radio.jsx +7 -7
- package/components/radio/styles/index.less +61 -29
- package/components/rate/demo/base.md +7 -1
- package/components/rate/rate.jsx +8 -3
- package/components/rate/star.jsx +4 -3
- package/components/rate/styles/index.less +5 -3
- package/components/select/select.jsx +2 -0
- package/components/skeleton/demo/custom.md +62 -0
- package/components/skeleton/demo/index.vue +2 -0
- package/components/skeleton/demo/items.md +6 -2
- package/components/skeleton/index.md +32 -12
- package/components/skeleton/skeleton.jsx +1 -3
- package/components/skeleton/skeletonAvatar.jsx +33 -7
- package/components/skeleton/skeletonButton.jsx +29 -4
- package/components/skeleton/skeletonImage.jsx +43 -6
- package/components/skeleton/skeletonText.jsx +29 -4
- package/components/slider/demo/base.md +7 -15
- package/components/slider/demo/formatter.md +19 -0
- package/components/slider/demo/index.vue +10 -1
- package/components/slider/demo/marks.md +42 -0
- package/components/slider/demo/reverse.md +26 -0
- package/components/slider/demo/vertical.md +26 -3
- package/components/slider/demo/withNumber.md +43 -0
- package/components/slider/index.md +15 -6
- package/components/slider/slider.jsx +173 -41
- package/components/slider/styles/index.less +109 -44
- package/components/slider/thumb.jsx +165 -0
- package/components/space/demo/align.md +22 -21
- package/components/space/demo/base.md +0 -1
- package/components/space/demo/index.vue +2 -0
- package/components/space/demo/size.md +34 -22
- package/components/space/demo/vertical.md +1 -1
- package/components/space/demo/wrap.md +12 -0
- package/components/space/index.md +6 -5
- package/components/space/space.jsx +40 -35
- package/components/space/styles/index.less +15 -0
- package/components/spin/demo/mode.md +6 -4
- package/components/spin/spin.jsx +1 -1
- package/components/styles/index.less +1 -0
- package/components/switch/demo/loading.md +1 -1
- package/components/switch/demo/text.md +3 -1
- package/components/switch/styles/index.less +31 -20
- package/components/table/styles/index.less +9 -10
- package/components/tooltip/styles/index.less +103 -76
- package/components/tooltip/tooltip.jsx +3 -0
- package/components/upload/styles/index.less +7 -0
- package/components/upload/upload.jsx +22 -12
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +1 -1
|
@@ -19,11 +19,11 @@ export default {
|
|
|
19
19
|
defaultChecked: checked,
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
watch: {
|
|
23
|
-
checked(checked) {
|
|
24
|
-
this.$emit("input", checked);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
22
|
+
// watch: {
|
|
23
|
+
// checked(checked) {
|
|
24
|
+
// this.$emit("input", checked);
|
|
25
|
+
// }
|
|
26
|
+
// },
|
|
27
27
|
methods: {
|
|
28
28
|
change(e) {
|
|
29
29
|
let { disabled, value, $slots, label, groupContext } = this
|
|
@@ -53,13 +53,13 @@ export default {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
const wpclasses = [
|
|
56
|
-
"k-radio
|
|
56
|
+
"k-radio", { ["k-radio-disabled"]: disabled, ["k-radio-checked"]: checked }
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
const labelNode = label || $slots.default
|
|
60
60
|
return (
|
|
61
61
|
<label class={wpclasses} onClick={e => e.stopPropagation()}>
|
|
62
|
-
<span class="k-radio">
|
|
62
|
+
<span class="k-radio-symbol">
|
|
63
63
|
<input type="radio" class="k-radio-input" disabled={disabled} checked={checked} onChange={change} />
|
|
64
64
|
<span class="k-radio-inner"></span>
|
|
65
65
|
</span>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
@import '../../styles/var.less';
|
|
2
2
|
.k-radio-group {
|
|
3
|
-
display: inline-block;
|
|
3
|
+
// display: inline-block;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
4
6
|
// font-size: 0;
|
|
5
7
|
// vertical-align: middle;
|
|
6
8
|
white-space: nowrap;
|
|
7
9
|
.k-btn {
|
|
8
10
|
position: relative;
|
|
9
|
-
margin-left: -1px
|
|
11
|
+
margin-left: -1px;
|
|
10
12
|
z-index: 0;
|
|
11
13
|
border-radius: 0;
|
|
12
14
|
&:focus, &:hover {
|
|
@@ -30,12 +32,15 @@
|
|
|
30
32
|
color: var(--kui-color-main);
|
|
31
33
|
border-color: var(--kui-color-main);
|
|
32
34
|
}
|
|
33
|
-
.k-radio
|
|
35
|
+
.k-radio {
|
|
34
36
|
margin-right: 16px;
|
|
35
37
|
}
|
|
36
|
-
.k-radio-label{
|
|
38
|
+
.k-radio-label {
|
|
37
39
|
font-size: 14px;
|
|
38
40
|
}
|
|
41
|
+
// .k-btn-solid {
|
|
42
|
+
// margin-left: -1px;
|
|
43
|
+
// }
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
.k-radio-cirle {
|
|
@@ -49,17 +54,16 @@
|
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
.k-radio
|
|
57
|
+
.k-radio {
|
|
53
58
|
user-select: none;
|
|
54
59
|
cursor: pointer;
|
|
55
60
|
display: inline-block;
|
|
56
61
|
line-height: 1;
|
|
57
62
|
color: var(--kui-color-font);
|
|
58
|
-
.k-radio {
|
|
63
|
+
.k-radio-symbol {
|
|
59
64
|
display: inline-block;
|
|
60
65
|
vertical-align: middle;
|
|
61
66
|
white-space: nowrap;
|
|
62
|
-
cursor: pointer;
|
|
63
67
|
outline: 0;
|
|
64
68
|
line-height: 1;
|
|
65
69
|
position: relative;
|
|
@@ -81,15 +85,14 @@
|
|
|
81
85
|
border-radius: 50%;
|
|
82
86
|
&:after {
|
|
83
87
|
box-sizing: content-box;
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
88
|
+
width: 0;
|
|
89
|
+
height: 0;
|
|
86
90
|
position: absolute;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
content: "
|
|
92
|
-
opacity: 0;
|
|
91
|
+
border-radius: 50%;
|
|
92
|
+
left: 50%;
|
|
93
|
+
top: 50%;
|
|
94
|
+
transform: translate3d(-50%, -50%, 0);
|
|
95
|
+
content: "";
|
|
93
96
|
background-color: var(--kui-color-main);
|
|
94
97
|
transition: all .2s ease-in-out;
|
|
95
98
|
}
|
|
@@ -103,8 +106,8 @@
|
|
|
103
106
|
left: 0;
|
|
104
107
|
right: 0;
|
|
105
108
|
z-index: 1;
|
|
106
|
-
cursor: pointer;
|
|
107
109
|
opacity: 0;
|
|
110
|
+
cursor: inherit;
|
|
108
111
|
&:focus {
|
|
109
112
|
+.k-radio-inner {
|
|
110
113
|
border: 1px solid var(--kui-color-main);
|
|
@@ -120,15 +123,13 @@
|
|
|
120
123
|
|
|
121
124
|
.k-radio-checked {
|
|
122
125
|
.k-radio-inner {
|
|
123
|
-
background: var(--kui-color-
|
|
126
|
+
background: var(--kui-color-main);
|
|
124
127
|
border-color: var(--kui-color-main);
|
|
125
|
-
position: relative;
|
|
126
128
|
&:after {
|
|
127
129
|
opacity: 1;
|
|
128
|
-
width:
|
|
129
|
-
height:
|
|
130
|
-
|
|
131
|
-
top: 3px;
|
|
130
|
+
width: 6px;
|
|
131
|
+
height: 6px;
|
|
132
|
+
background-color: #fff; //var(--kui-color-back);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
}
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
cursor: not-allowed;
|
|
138
139
|
// opacity: .5;
|
|
139
140
|
color: var(--kui-color-disable-color);
|
|
140
|
-
|
|
141
|
+
&.k-radio {
|
|
141
142
|
.k-radio-input {
|
|
142
143
|
cursor: not-allowed;
|
|
143
144
|
}
|
|
@@ -152,10 +153,41 @@
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
.k-radio-group-vertical {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
display: block;
|
|
157
|
+
.k-radio {
|
|
158
|
+
display: block;
|
|
159
|
+
margin-right: 0;
|
|
160
|
+
margin-bottom: 16px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.k-radio-group-light {
|
|
165
|
+
.k-btn {
|
|
166
|
+
margin-left: 0;
|
|
167
|
+
&:nth-child(n+2) {
|
|
168
|
+
position: relative;
|
|
169
|
+
&::before {
|
|
170
|
+
position: absolute;
|
|
171
|
+
content: '';
|
|
172
|
+
left: -1px;
|
|
173
|
+
border-left: 1px solid var(--kui-color-border);
|
|
174
|
+
height: 50%;
|
|
175
|
+
top: 50%;
|
|
176
|
+
transform: translateY(-50%);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.k-radio-group-card {
|
|
183
|
+
padding: 4px;
|
|
184
|
+
background-color: var(--kui-color-gray-80);
|
|
185
|
+
border-radius: var(--kui-border-radius);
|
|
186
|
+
.k-btn {
|
|
187
|
+
border: none;
|
|
188
|
+
border-radius: var(--kui-border-radius);
|
|
189
|
+
&:disabled {
|
|
190
|
+
background: 0 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
161
193
|
}
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<div>
|
|
9
|
-
<Rate />
|
|
9
|
+
<Rate :size="30" :value="2"/>
|
|
10
|
+
<br/>
|
|
11
|
+
<Rate :value="3"/>
|
|
12
|
+
<br />
|
|
13
|
+
<Rate icon="heart" allowHalf color="red" :value="2.5" :size="30"/>
|
|
14
|
+
<br />
|
|
15
|
+
<Rate icon="heart" allowHalf color="red" :value="3.5" :size="40"/>
|
|
10
16
|
</div>
|
|
11
17
|
</template>
|
|
12
18
|
```
|
package/components/rate/rate.jsx
CHANGED
|
@@ -11,7 +11,9 @@ export default {
|
|
|
11
11
|
count: { type: Number, default: 5 },
|
|
12
12
|
disabled: Boolean,
|
|
13
13
|
tooltips: Array,
|
|
14
|
-
showScore: Boolean
|
|
14
|
+
showScore: Boolean,
|
|
15
|
+
size: Number,
|
|
16
|
+
color: String
|
|
15
17
|
},
|
|
16
18
|
data() {
|
|
17
19
|
return {
|
|
@@ -26,7 +28,7 @@ export default {
|
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
render() {
|
|
29
|
-
let { count, tempValue, allowHalf, character, disabled, tooltips = [], icon, showScore } = this
|
|
31
|
+
let { count, tempValue, allowHalf, character, disabled, tooltips = [], icon, showScore, size, color } = this
|
|
30
32
|
const stars = []
|
|
31
33
|
if (Number(count) == NaN || count <= 0) {
|
|
32
34
|
count = 5
|
|
@@ -44,7 +46,7 @@ export default {
|
|
|
44
46
|
allowHalf,
|
|
45
47
|
full: tempValue > i && !half,
|
|
46
48
|
half,
|
|
47
|
-
icon, character,
|
|
49
|
+
icon, character, size,
|
|
48
50
|
disabled,
|
|
49
51
|
value: i,
|
|
50
52
|
percent,
|
|
@@ -63,6 +65,9 @@ export default {
|
|
|
63
65
|
class: "k-rate",
|
|
64
66
|
on: { mouseleave: this.reset }
|
|
65
67
|
}
|
|
68
|
+
if (color) {
|
|
69
|
+
props.style = { color }
|
|
70
|
+
}
|
|
66
71
|
return (
|
|
67
72
|
<div {...props}>
|
|
68
73
|
{stars}
|
package/components/rate/star.jsx
CHANGED
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
allowHalf: Boolean,
|
|
13
13
|
disabled: Boolean,
|
|
14
14
|
icon: [String, Function],
|
|
15
|
+
size: Number,
|
|
15
16
|
},
|
|
16
17
|
data() {
|
|
17
18
|
return {
|
|
@@ -20,7 +21,7 @@ export default {
|
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
render() {
|
|
23
|
-
let { character, checked, full, half, allowHalf, tooltips, icon, percent, disabled } = this
|
|
24
|
+
let { character, checked, full, half, allowHalf, tooltips, icon, percent, disabled, size } = this
|
|
24
25
|
const props = {
|
|
25
26
|
class: ['k-star', {
|
|
26
27
|
'k-star-checked': checked,
|
|
@@ -46,8 +47,8 @@ export default {
|
|
|
46
47
|
}
|
|
47
48
|
character = character ? <span>{character}</span> : null
|
|
48
49
|
const node = <span {...props}>
|
|
49
|
-
<span class={['k-star-front', {}]} style={{ width: show_percent ? percent + '%' : null }}>{character || <Icon type={icon || 'star'} />}</span>
|
|
50
|
-
<span class="k-star-back">{character || <Icon type={icon || 'star'} />}</span>
|
|
50
|
+
<span class={['k-star-front', {}]} style={{ width: show_percent ? percent + '%' : null }}>{character || <Icon type={icon || 'star'} size={size} />}</span>
|
|
51
|
+
<span class="k-star-back">{character || <Icon type={icon || 'star'} size={size} />}</span>
|
|
51
52
|
</span>
|
|
52
53
|
return tooltips ? <Tooltip title={tooltips}>{node}</Tooltip> : node
|
|
53
54
|
},
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
.k-rate {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
font-size: 20px;
|
|
5
|
+
color: orange;
|
|
6
|
+
line-height: 1;
|
|
5
7
|
.k-star {
|
|
6
8
|
display: inline-block;
|
|
7
9
|
margin-right: 8px;
|
|
@@ -27,19 +29,19 @@
|
|
|
27
29
|
}
|
|
28
30
|
.k-star-half {
|
|
29
31
|
.k-star-front {
|
|
30
|
-
color: orange;
|
|
32
|
+
// color: orange;
|
|
31
33
|
opacity: 1;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
.k-star-full {
|
|
35
37
|
.k-star-front {
|
|
36
|
-
color: orange;
|
|
38
|
+
// color: orange;
|
|
37
39
|
width: 100%;
|
|
38
40
|
opacity: 1;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
.k-rate-score {
|
|
42
|
-
color: orange;
|
|
44
|
+
// color: orange;
|
|
43
45
|
font-size: 14px;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -307,6 +307,8 @@ export default {
|
|
|
307
307
|
// ? <li class="k-select-empty" onClick={this.emptyClick}><Icon type="albums" /><p class="k-empty-desc">暂无数据</p></li>
|
|
308
308
|
// : childs
|
|
309
309
|
// )
|
|
310
|
+
// console.log(this.$el)
|
|
311
|
+
|
|
310
312
|
const loadingNode = <div class="k-select-loading"><Icon type="sync" spin /><span>{t('k.select.loading')}</span></div>
|
|
311
313
|
const props = {
|
|
312
314
|
ref: 'overlay',
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 自定义
|
|
3
|
+
自定义效果。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<Button :disabled="loading" @click="showSkeleton">重新加载</Button>
|
|
9
|
+
<br/>
|
|
10
|
+
<br/>
|
|
11
|
+
<Card v-for="x in 3" class="demo-skeleton-card" title="诗一首" :key="x">
|
|
12
|
+
<SkeletonImage animated :loading="loading" :radius="8" style="width:166px;height:100px;">
|
|
13
|
+
<div class="cover" />
|
|
14
|
+
</SkeletonImage>
|
|
15
|
+
<SkeletonText animated :loading="loading" size="small" style="min-width:80px;margin:8px 0;">
|
|
16
|
+
<h2>静夜思.李白</h2>
|
|
17
|
+
</SkeletonText>
|
|
18
|
+
<SkeletonText animated :loading="loading" size="small" style="min-width:130px;">
|
|
19
|
+
<span>床前明月光, 疑是地上霜, 举头望明月, 低头思故乡.</span>
|
|
20
|
+
</SkeletonText>
|
|
21
|
+
</Card>
|
|
22
|
+
</template>
|
|
23
|
+
<style>
|
|
24
|
+
.demo-skeleton-card{
|
|
25
|
+
width:200px;
|
|
26
|
+
margin-bottom:10px;
|
|
27
|
+
display:inline-block;
|
|
28
|
+
margin-right:20px;
|
|
29
|
+
}
|
|
30
|
+
.demo-skeleton-card .cover{
|
|
31
|
+
height:100px;
|
|
32
|
+
width:166px;
|
|
33
|
+
border-radius:8px;
|
|
34
|
+
background:url("https://www.chuchur.com/upload/demo/test_300.jpg") no-repeat center;
|
|
35
|
+
background-size:cover;
|
|
36
|
+
}
|
|
37
|
+
.demo-skeleton-card h2{
|
|
38
|
+
font-size:15px;
|
|
39
|
+
}
|
|
40
|
+
.demo-skeleton-card span{
|
|
41
|
+
font-size:13px;
|
|
42
|
+
color:#999;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
<script>
|
|
46
|
+
export default{
|
|
47
|
+
data(){
|
|
48
|
+
return {
|
|
49
|
+
loading:false,
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
showSkeleton(){
|
|
54
|
+
this.loading = true,
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
this.loading = false
|
|
57
|
+
}, 3000);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
@@ -6,6 +6,7 @@ import Animated from './animated.md'
|
|
|
6
6
|
import Child from './child.md'
|
|
7
7
|
import List from './list.md'
|
|
8
8
|
import Items from './items.md'
|
|
9
|
+
import Custom from './custom.md'
|
|
9
10
|
|
|
10
11
|
import CN from '../index.md'
|
|
11
12
|
export default {
|
|
@@ -19,6 +20,7 @@ export default {
|
|
|
19
20
|
<Child />
|
|
20
21
|
<List />
|
|
21
22
|
<Items />
|
|
23
|
+
<Custom />
|
|
22
24
|
<CN class="typo" />
|
|
23
25
|
</div>
|
|
24
26
|
)
|
|
@@ -18,9 +18,12 @@
|
|
|
18
18
|
</Space>
|
|
19
19
|
<br/>
|
|
20
20
|
<br/>
|
|
21
|
-
<Space :size="15">
|
|
21
|
+
<Space :size="15" style="width:300px;">
|
|
22
22
|
Image radius: <Slider v-model="radius" />
|
|
23
23
|
</Space>
|
|
24
|
+
<Space :size="15" style="width:300px;">
|
|
25
|
+
Image Size: <Slider v-model="imgSize" range :min="80" :max="320"/>
|
|
26
|
+
</Space>
|
|
24
27
|
<br/>
|
|
25
28
|
<br/>
|
|
26
29
|
<Space>
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
<SkeletonButton :animated="animated" :size="size" :shape="btnShape" :block="block" />
|
|
34
37
|
<br/>
|
|
35
38
|
<br/>
|
|
36
|
-
<SkeletonImage :animated="animated" :radius="radius"/>
|
|
39
|
+
<SkeletonImage :animated="animated" :radius="radius" :size="imgSize"/>
|
|
37
40
|
</template>
|
|
38
41
|
<script>
|
|
39
42
|
export default{
|
|
@@ -53,6 +56,7 @@ export default{
|
|
|
53
56
|
{ label :'Square', value :'square' },
|
|
54
57
|
{ label :'Circle', value :'circle' },
|
|
55
58
|
],
|
|
59
|
+
imgSize: [96,96],
|
|
56
60
|
animated :false,
|
|
57
61
|
size :'default',
|
|
58
62
|
block :false,
|
|
@@ -9,17 +9,37 @@
|
|
|
9
9
|
| delay | 防抖(动画延迟关闭) | Number(毫秒) | 500 |
|
|
10
10
|
|
|
11
11
|
## Avatar Props
|
|
12
|
-
| 属性 | 说明
|
|
13
|
-
| -------- |
|
|
14
|
-
| animated | 是否展示动画效果
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
12
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
13
|
+
| -------- | -------------------------------------------- | ----------------------------------- | ------ |
|
|
14
|
+
| animated | 是否展示动画效果 | Boolean | false |
|
|
15
|
+
| radius | 指定图片的圆角大小 | Number | - |
|
|
16
|
+
| shape | 指定头像的形状 | circle \| square | false |
|
|
17
|
+
| loading | 为 true 时,显示占位图。反之则直接展示子组件 | Boolean | - |
|
|
18
|
+
| size | 设置头像占位图的大小 | number \| large \| small \| default | - |
|
|
18
19
|
|
|
19
20
|
## Button Props
|
|
20
|
-
| 属性 | 说明
|
|
21
|
-
| -------- |
|
|
22
|
-
| animated | 是否展示动画效果
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
21
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
22
|
+
| -------- | -------------------------------------------- | -------------------------- | ------ |
|
|
23
|
+
| animated | 是否展示动画效果 | Boolean | false |
|
|
24
|
+
| loading | 为 true 时,显示占位图。反之则直接展示子组件 | Boolean | - |
|
|
25
|
+
| shape | 指定头像的形状 | circle \| round \| default | - |
|
|
26
|
+
| size | 设置按钮的大小 | large \| small \| default | - |
|
|
27
|
+
| block | 将按钮宽度调整为其父宽度的选项 | Boolean | - |
|
|
28
|
+
| width | 按钮宽度 | Number | - |
|
|
29
|
+
|
|
30
|
+
## Text Props
|
|
31
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
32
|
+
| -------- | -------------------------------------------- | ------------------------- | ------ |
|
|
33
|
+
| animated | 是否展示动画效果 | Boolean | false |
|
|
34
|
+
| loading | 为 true 时,显示占位图。反之则直接展示子组件 | Boolean | - |
|
|
35
|
+
| size | 设置文本的大小 | large \| small \| default | - |
|
|
36
|
+
| width | 文本宽度 | Number | - |
|
|
37
|
+
|
|
38
|
+
## Image Props
|
|
39
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
40
|
+
| -------- | -------------------------------------------- | ------------- | ------ |
|
|
41
|
+
| animated | 是否展示动画效果 | Boolean | false |
|
|
42
|
+
| loading | 为 true 时,显示占位图。反之则直接展示子组件 | Boolean | - |
|
|
43
|
+
| radius | 指定图片的圆角大小 | Number | - |
|
|
44
|
+
| size | 图片的宽(高)度 | Number\|Array | - |
|
|
45
|
+
|
|
@@ -9,8 +9,6 @@ export default {
|
|
|
9
9
|
},
|
|
10
10
|
watch: {
|
|
11
11
|
loading(v) {
|
|
12
|
-
this.show = v
|
|
13
|
-
|
|
14
12
|
if (v) {
|
|
15
13
|
this.show = v
|
|
16
14
|
} else {
|
|
@@ -71,7 +69,7 @@ export default {
|
|
|
71
69
|
let child = this.$slots.default
|
|
72
70
|
return (
|
|
73
71
|
<div {...props}>
|
|
74
|
-
{child
|
|
72
|
+
{child && !show ? child : [nodeAvatar, nodeContent]}
|
|
75
73
|
</div>
|
|
76
74
|
)
|
|
77
75
|
}
|
|
@@ -2,29 +2,55 @@ export default {
|
|
|
2
2
|
props: {
|
|
3
3
|
animated: Boolean,
|
|
4
4
|
radius: Number,
|
|
5
|
+
loading: Boolean,
|
|
6
|
+
delay: { type: Number, default: 500 },
|
|
5
7
|
shape: String,
|
|
6
|
-
size: String
|
|
8
|
+
size: [Number, String]
|
|
9
|
+
},
|
|
10
|
+
watch: {
|
|
11
|
+
loading(v) {
|
|
12
|
+
if (v) {
|
|
13
|
+
this.show = v
|
|
14
|
+
} else {
|
|
15
|
+
clearTimeout(this.timer)
|
|
16
|
+
this.timer = setTimeout(() => {
|
|
17
|
+
this.show = v
|
|
18
|
+
}, this.delay);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
show: this.loading
|
|
25
|
+
}
|
|
7
26
|
},
|
|
8
27
|
render() {
|
|
9
|
-
let { size, animated, radius, shape } = this
|
|
28
|
+
let { size, animated, radius, shape, show } = this
|
|
10
29
|
let props = {
|
|
11
30
|
class: ['k-skeleton k-skeleton-ele', {
|
|
12
31
|
'k-skeleton-animated': animated,
|
|
13
32
|
}]
|
|
14
33
|
}
|
|
15
|
-
let
|
|
34
|
+
let innerProps = {
|
|
16
35
|
class: ['k-skeleton-avatar', {
|
|
17
36
|
'k-skeleton-avatar-lg': size == 'large',
|
|
18
37
|
'k-skeleton-avatar-sm': size == 'small',
|
|
19
38
|
[`k-skeleton-avatar-${shape}`]: shape != 'default',
|
|
20
39
|
}],
|
|
21
|
-
style: {
|
|
22
|
-
'border-radius': radius ? radius + 'px' : ''
|
|
23
|
-
}
|
|
24
40
|
}
|
|
41
|
+
let child = this.$slots.default
|
|
42
|
+
|
|
43
|
+
if (!isNaN(Number(size))) {
|
|
44
|
+
innerProps.style.width = `${size}px`
|
|
45
|
+
innerProps.style.height = `${size}px`
|
|
46
|
+
}
|
|
47
|
+
if (radius) {
|
|
48
|
+
innerProps.style['border-radius'] = `${radius}px`
|
|
49
|
+
}
|
|
50
|
+
|
|
25
51
|
return (
|
|
26
52
|
<div {...props}>
|
|
27
|
-
<span {...
|
|
53
|
+
{child && !show ? child : <span {...innerProps}></span>}
|
|
28
54
|
</div >
|
|
29
55
|
)
|
|
30
56
|
}
|
|
@@ -2,27 +2,52 @@ export default {
|
|
|
2
2
|
props: {
|
|
3
3
|
animated: Boolean,
|
|
4
4
|
block: Boolean,
|
|
5
|
+
loading: Boolean,
|
|
6
|
+
delay: { type: Number, default: 500 },
|
|
5
7
|
shape: String,
|
|
6
|
-
size: String
|
|
8
|
+
size: String,
|
|
9
|
+
width: Number,
|
|
10
|
+
},
|
|
11
|
+
watch: {
|
|
12
|
+
loading(v) {
|
|
13
|
+
if (v) {
|
|
14
|
+
this.show = v
|
|
15
|
+
} else {
|
|
16
|
+
clearTimeout(this.timer)
|
|
17
|
+
this.timer = setTimeout(() => {
|
|
18
|
+
this.show = v
|
|
19
|
+
}, this.delay);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
show: this.loading
|
|
26
|
+
}
|
|
7
27
|
},
|
|
8
28
|
render() {
|
|
9
|
-
let { size, animated, block, shape } = this
|
|
29
|
+
let { size, animated, block, shape, show, width } = this
|
|
10
30
|
let props = {
|
|
11
31
|
class: ['k-skeleton k-skeleton-ele', {
|
|
12
32
|
'k-skeleton-animated': animated,
|
|
13
33
|
'k-skeleton-block': block,
|
|
14
34
|
}]
|
|
15
35
|
}
|
|
16
|
-
let
|
|
36
|
+
let innerProps = {
|
|
17
37
|
class: ['k-skeleton-btn', {
|
|
18
38
|
'k-skeleton-btn-lg': size == 'large',
|
|
19
39
|
'k-skeleton-btn-sm': size == 'small',
|
|
20
40
|
[`k-skeleton-btn-${shape}`]: shape != 'default',
|
|
21
41
|
}],
|
|
22
42
|
}
|
|
43
|
+
let child = this.$slots.default
|
|
44
|
+
|
|
45
|
+
if (width) {
|
|
46
|
+
innerProps.style.width = `${width}px`
|
|
47
|
+
}
|
|
23
48
|
return (
|
|
24
49
|
<div {...props}>
|
|
25
|
-
<span {...
|
|
50
|
+
{child && !show ? child : <span {...innerProps}></span>}
|
|
26
51
|
</div >
|
|
27
52
|
)
|
|
28
53
|
}
|