Skip to content

Commit 2007389

Browse files
lm312hzsrc
authored andcommitted
Progress: add color prop (ElemeFE#22089)
* el-select添加selected选中颜色配置 * fix: issues ElemeFE#22065, el-progress添加底色,文字颜色的属性
1 parent 0034a49 commit 2007389

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

packages/progress/src/progress.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
aria-valuemax="100"
1616
>
1717
<div class="el-progress-bar" v-if="type === 'line'">
18-
<div class="el-progress-bar__outer" :style="{height: strokeWidth + 'px'}">
18+
<div class="el-progress-bar__outer" :style="{height: strokeWidth + 'px', backgroundColor:defineBackColor}">
1919
<div class="el-progress-bar__inner" :style="barStyle">
20-
<div class="el-progress-bar__innerText" v-if="showText && textInside">{{content}}</div>
20+
<div class="el-progress-bar__innerText" :style="{color:textColor}" v-if="showText && textInside">{{content}}</div>
2121
</div>
2222
</div>
2323
</div>
@@ -26,7 +26,7 @@
2626
<path
2727
class="el-progress-circle__track"
2828
:d="trackPath"
29-
stroke="#e5e9f2"
29+
:stroke="defineBackColor"
3030
:stroke-width="relativeStrokeWidth"
3131
fill="none"
3232
:style="trailPathStyle"></path>
@@ -43,7 +43,7 @@
4343
<div
4444
class="el-progress__text"
4545
v-if="showText && !textInside"
46-
:style="{fontSize: progressTextSize + 'px'}"
46+
:style="{fontSize: progressTextSize + 'px', color:textColor}"
4747
>
4848
<template v-if="!status">{{content}}</template>
4949
<i v-else :class="iconClass"></i>
@@ -93,6 +93,14 @@
9393
type: [String, Array, Function],
9494
default: ''
9595
},
96+
defineBackColor: {
97+
type: [String, Array, Function],
98+
default: '#ebeef5'
99+
},
100+
textColor: {
101+
type: [String, Array, Function],
102+
default: '#606266'
103+
},
96104
format: Function
97105
},
98106
computed: {

packages/select/src/option.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
disabled: {
3838
type: Boolean,
3939
default: false
40+
},
41+
selectedColor: {
42+
type: String,
43+
default: '#409EFF'
4044
}
4145
},
4246
@@ -131,6 +135,24 @@
131135
selectOptionClick() {
132136
if (this.disabled !== true && this.groupDisabled !== true) {
133137
this.dispatch('ElSelect', 'handleOptionClick', [this, true]);
138+
if (this.selectedColor !== '#409EFF') {
139+
// 如果不是默认的颜色
140+
if (this.$el.className === 'el-select-dropdown__item selected hover' ||
141+
this.$el.className === 'el-select-dropdown__item hover'
142+
) {
143+
let siblingsNode = this.$parent.$children;
144+
siblingsNode.forEach(item=>{
145+
if (item.$el.className === 'el-select-dropdown__item' ||
146+
item.$el.className === 'el-select-dropdown__item selected') {
147+
item.$el.style.color = '#606266';
148+
}
149+
});
150+
this.$el.style.color = this.selectedColor;
151+
} else {
152+
this.$el.style.color = '#606266';
153+
}
154+
155+
}
134156
}
135157
},
136158
@@ -150,6 +172,7 @@
150172
151173
this.$on('queryChange', this.queryChange);
152174
this.$on('handleGroupDisabled', this.handleGroupDisabled);
175+
153176
},
154177
155178
beforeDestroy() {

0 commit comments

Comments
 (0)