Skip to content

Commit 9e4c7fe

Browse files
committed
Merge remote-tracking branch 'origin/feature/createWebAndCreateBaseCpont' into feature/createWebAndCreateBaseCpont
2 parents d8064a6 + 4d8de88 commit 9e4c7fe

File tree

6 files changed

+423
-37
lines changed

6 files changed

+423
-37
lines changed

src/components/notification/src/notification.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
<div :class="['py-notification', customClass, horizontalClass]"
44
v-show="visible" :style="positionStyle"
55
@click="click" @mouseenter="clearTimer()" @mouseleave="startTimer()">
6-
<i class="py-notification__icon pyui-icons"
6+
<!-- <i class="py-notification__icon pyui-icons"
77
:class="[ typeClass, iconClass ]"
8-
v-if="type || iconClass"></i>
8+
v-if="type || iconClass"></i> -->
9+
<py-icon v-if="type" class="py-notification__icon" :type="typeClass"></py-icon>
10+
<i v-else-if="iconClass.length > 0" class="py-notification__icon" :class="iconClass"></i>
911
<div class="py-notification__group">
1012
<h2 class="py-notification__title" v-text="title"></h2>
1113
<div class="py-notification__content" v-show="message">
@@ -14,16 +16,15 @@
1416
<p v-else v-html="message"></p>
1517
</slot>
1618
</div>
17-
<i class="py-notification__closeBtn pyui-icons py-icon-close"
18-
v-if="showClose"
19-
@click.stop="close"></i>
19+
<py-icon type="close" class="py-notification__closeBtn"
20+
v-if="showClose" @click.stop="close"></py-icon>
2021
</div>
2122
</div>
2223
</transition>
2324
</template>
2425

2526
<script>
26-
// import PyIcon from '../../icon/index.js';
27+
import PyIcon from '../../icon/index';
2728
/**
2829
* 与type属性相关联的可选的消息类型,如果不在可选值内将被忽略
2930
*/
@@ -49,8 +50,8 @@ export default {
4950
type: '',
5051
// 是否显示关闭按钮
5152
showClose: true,
52-
// 自定义类名
53-
customClass: '',
53+
// 自定义类名数组形式传入
54+
customClass: [],
5455
// 自定义图标的类名。若设置了 type,则 iconClass 会被覆盖
5556
iconClass: '',
5657
// 关闭时的回调函数
@@ -69,9 +70,9 @@ export default {
6970
position: 'top-right',
7071
};
7172
},
72-
// components: {
73-
// 'py-icon': PyIcon,
74-
// },
73+
components: {
74+
'py-icon': PyIcon,
75+
},
7576
watch: {
7677
closed(newVal) {
7778
if (newVal) {
@@ -83,7 +84,8 @@ export default {
8384
computed: {
8485
// 提示图标
8586
typeClass() {
86-
return this.type && typeMap[this.type] ? `py-icon-${typeMap[this.type]}` : '';
87+
// return this.type && typeMap[this.type] ? `py-icon-${typeMap[this.type]}` : '';
88+
return this.type && typeMap[this.type] ? `${typeMap[this.type]}` : '';
8789
},
8890
// 水平位置
8991
horizontalClass() {

src/styles/src/notification.scss

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,11 @@ $--notification-info-color: $info-color !default;
2121
$--notification-warning-color: $warning-color !default;
2222
$--notification-danger-color: $error-color !default;
2323

24-
$prefixCls: 'py-notification';
24+
$prefixCls: 'notification';
2525
$element-separator: '__';
2626
$modifier-separator: '--';
2727

28-
.#{$prefixCls}-fade-enter {
29-
&.right {
30-
right: 0;
31-
transform: translateX(100%);
32-
}
33-
34-
&.left {
35-
left: 0;
36-
transform: translateX(-100%);
37-
}
38-
}
39-
40-
.#{$prefixCls}-fade-leave-active {
41-
opacity: 0;
42-
}
43-
44-
.#{$prefixCls} {
28+
@include b($prefixCls) {
4529
display: flex;
4630
width: $--notification-width;
4731
padding: $--notification-padding;
@@ -53,6 +37,23 @@ $modifier-separator: '--';
5337
box-shadow: $--notification-shadow;
5438
transition: opacity 0.3s, transform 0.3s, left 0.3s, right 0.3s, top 0.4s, bottom 0.3s;
5539
overflow: hidden;
40+
z-index: 5000;
41+
42+
&-fade-enter {
43+
&.right {
44+
right: 0;
45+
transform: translateX(100%);
46+
}
47+
48+
&.left {
49+
left: 0;
50+
transform: translateX(-100%);
51+
}
52+
}
53+
54+
&-fade-leave-active {
55+
opacity: 0;
56+
}
5657

5758
&.right {
5859
right: 16px;
@@ -61,16 +62,16 @@ $modifier-separator: '--';
6162
&.left {
6263
left: 16px;
6364
}
64-
&#{$element-separator}group {
65+
@include e(group) {
6566
margin-left: $--notification-group-margin;
6667
}
67-
&#{$element-separator}title {
68+
@include e(title) {
6869
font-weight: bold;
6970
font-size: $--notification-title-font-size;
7071
color: $--notification-title-color;
7172
margin: 0;
7273
}
73-
&#{$element-separator}content {
74+
@include e(content) {
7475
font-size: $--notification-font-size;
7576
line-height: 21px;
7677
margin: 6px 0 0 0;
@@ -81,14 +82,12 @@ $modifier-separator: '--';
8182
margin: 0;
8283
}
8384
}
84-
85-
&#{$element-separator}icon {
85+
@include e(icon) {
8686
height: $--notification-icon-size;
8787
width: $--notification-icon-size;
8888
font-size: $--notification-icon-size;
8989
}
90-
91-
&#{$element-separator}closeBtn {
90+
@include e(closeBtn) {
9291
position: absolute;
9392
top: 18px;
9493
right: 15px;

src/testsDemo/notification/notification.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<py-button @click="open4">警告</py-button>
1414
<py-button @click="open5">消息</py-button>
1515
<py-button @click="open6">错误</py-button>
16+
<py-button @click="open14">自定义图标</py-button>
1617
</div>
1718
<h3>自定义弹出位置</h3>
1819
<div class="py-button-box">
@@ -131,6 +132,13 @@ export default {
131132
showClose: false,
132133
});
133134
},
135+
open14() {
136+
this.$notify({
137+
title: 'Info',
138+
message: '这是一条没有关闭按钮的消息',
139+
iconClass: ['pyui-icons', 'py-icon-heart-fill'],
140+
});
141+
},
134142
},
135143
};
136144
</script>

website/docs/colorPicker.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## ColorPicker 颜色选择器
2+
3+
用于颜色选择,支持多种格式。
4+
5+
### 基础用法
6+
7+
::: demo ColorPicker组件支持选择普通颜色,也支持带 Alpha 通道的颜色即支持透明度的选择,支持选择预定义的颜色。
8+
9+
```html
10+
<py-color-picker ></py-color-picker>
11+
12+
```
13+
14+
:::
15+

0 commit comments

Comments
 (0)