Skip to content

Commit 203965a

Browse files
author
xutao15
committed
complete component
1 parent 61f9265 commit 203965a

File tree

299 files changed

+12674
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+12674
-64
lines changed

dist/components/alert/alert.vue

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<template>
2+
<div class="i-alert"
3+
:class="[iClass, 'i-alert-' + type, showIcon ? 'i-alert-with-icon' : '', desc ? 'i-alert-with-desc' : '']"
4+
v-if="!closed">
5+
<div v-if="showIcon" class="i-alert-icon">
6+
<i-icon type="prompt" :size="desc ? 24 : 16" v-if="type === 'info'"></i-icon>
7+
<i-icon type="success" :size="desc ? 24 : 16" v-if="type === 'success'"></i-icon>
8+
<i-icon type="warning" :size="desc ? 24 : 16" v-if="type === 'warning'"></i-icon>
9+
<i-icon type="delete" :size="desc ? 24 : 16" v-if="type === 'error'"></i-icon>
10+
</div>
11+
<slot></slot>
12+
<div class="i-alert-desc">
13+
<slot name="desc"></slot>
14+
</div>
15+
<div class="i-alert-close" v-if="closable" @click="handleTap">
16+
<i-icon type="close"></i-icon>
17+
</div>
18+
</div>
19+
</template>
20+
<script>
21+
import icon from '../icon/icon'
22+
export default {
23+
components: {
24+
'i-icon': icon
25+
},
26+
props: {
27+
type: {
28+
type: String,
29+
default: 'info'
30+
},
31+
closable: {
32+
type: Boolean,
33+
value: false
34+
},
35+
showIcon: {
36+
type: Boolean,
37+
default: false
38+
},
39+
desc: {
40+
type: Boolean,
41+
default: false
42+
}
43+
},
44+
data() {
45+
return {
46+
closed: false
47+
}
48+
},
49+
methods: {
50+
handleTap() {
51+
this.closed = !this.closed
52+
this.$emit('close')
53+
}
54+
}
55+
}
56+
</script>

dist/components/alert/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import alert from 'alert.vue'
2+
3+
export default alert

dist/components/alert/style/alert.css

Lines changed: 488 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@import "../../common/_base.less";
2+
@import "../../common/_mixins.less";
3+
@import "../../icon/style/icon.less";
4+
5+
.bg-color(@color) {
6+
color: #fff;
7+
background: @color;
8+
}
9+
10+
.i-alert {
11+
position: relative;
12+
margin: 10px;
13+
padding: 8px 48px 8px 16px;
14+
font-size: @size-font-base;
15+
border-radius: 2px;
16+
.bg-color(@background-color-base);
17+
color: @text-color;
18+
19+
&&-with-icon {
20+
padding: 8px 48px 8px 38px;
21+
}
22+
&-info {
23+
.bg-color(@info-color);
24+
}
25+
&-success {
26+
.bg-color(@success-color);
27+
}
28+
&-warning {
29+
.bg-color(@warning-color);
30+
}
31+
&-error {
32+
.bg-color(@error-color);
33+
}
34+
&-icon {
35+
position: absolute;
36+
top: 9px;
37+
left: 16px;
38+
font-size: @size-font-base;
39+
}
40+
&-desc {
41+
font-size: @size-font-small;
42+
}
43+
&-with-desc {
44+
padding: 16px;
45+
position: relative;
46+
}
47+
&-with-desc&-with-icon {
48+
padding: 16px 16px 16px 69px;
49+
}
50+
&-with-desc &-icon {
51+
top: 50%;
52+
left: 24px;
53+
margin-top: -21px;
54+
font-size: 28px;
55+
}
56+
&-close {
57+
font-size: @size-font-small;
58+
position: absolute;
59+
right: 16px;
60+
top: 8px;
61+
overflow: hidden;
62+
cursor: pointer;
63+
}
64+
}

dist/components/alert/style/css.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './alert.css'

dist/components/alert/style/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './alert.less'

dist/components/avatar/avatar.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div class="i-avatar" :class="[iClass, 'i-avatar-' + shape, 'i-avatar-' + size, src ? 'i-avatar-image' : '']">
3+
<image :src="src" v-if="src"></image>
4+
<div class="i-avatar-string" v-else><slot></slot></div>
5+
</div>
6+
</template>
7+
<script>
8+
export default {
9+
props: {
10+
shape: {
11+
type: String,
12+
default: 'circle'
13+
},
14+
size: {
15+
type: String,
16+
default: 'default'
17+
},
18+
src: {
19+
type: String,
20+
default: ''
21+
}
22+
}
23+
}
24+
</script>

dist/components/avatar/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import avatar from 'avatar.vue'
2+
3+
export default avatar
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.i-avatar {
2+
display: inline-block;
3+
text-align: center;
4+
background: #ccc;
5+
color: #fff;
6+
white-space: nowrap;
7+
position: relative;
8+
overflow: hidden;
9+
vertical-align: middle;
10+
width: 32px;
11+
height: 32px;
12+
line-height: 32px;
13+
border-radius: 16px;
14+
font-size: 18px;
15+
}
16+
.i-avatar .ivu-avatar-string {
17+
line-height: 32px;
18+
}
19+
.i-avatar-large {
20+
width: 40px;
21+
height: 40px;
22+
line-height: 40px;
23+
border-radius: 20px;
24+
font-size: 24px;
25+
}
26+
.i-avatar-large .ivu-avatar-string {
27+
line-height: 40px;
28+
}
29+
.i-avatar-small {
30+
width: 24px;
31+
height: 24px;
32+
line-height: 24px;
33+
border-radius: 12px;
34+
font-size: 14px;
35+
}
36+
.i-avatar-small .ivu-avatar-string {
37+
line-height: 24px;
38+
}
39+
.i-avatar-image {
40+
background: transparent;
41+
}
42+
.i-avatar-square {
43+
border-radius: 4px;
44+
}
45+
.i-avatar > image {
46+
width: 100%;
47+
height: 100%;
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@import "../../common/_base.less";
2+
@import "../../common/_mixins.less";
3+
4+
.i-avatar {
5+
display: inline-block;
6+
text-align: center;
7+
background: @avatar-bg;
8+
color: @avatar-color;
9+
white-space: nowrap;
10+
position: relative;
11+
overflow: hidden;
12+
vertical-align: middle;
13+
14+
.avatar-size(@avatar-size-base, @avatar-font-size-base);
15+
16+
&-large {
17+
.avatar-size(@avatar-size-lg, @avatar-font-size-lg);
18+
}
19+
20+
&-small {
21+
.avatar-size(@avatar-size-sm, @avatar-font-size-sm);
22+
}
23+
24+
&-image {
25+
background: transparent;
26+
}
27+
28+
&-square {
29+
border-radius: @avatar-border-radius;
30+
}
31+
32+
& > image {
33+
width: 100%;
34+
height: 100%;
35+
}
36+
}
37+
38+
.avatar-size(@size, @font-size) {
39+
width: @size;
40+
height: @size;
41+
line-height: @size;
42+
border-radius: @size / 2;
43+
font-size: @font-size;
44+
45+
.ivu-avatar-string {
46+
line-height: @size;
47+
}
48+
}

0 commit comments

Comments
 (0)