File tree Expand file tree Collapse file tree 3 files changed +40
-26
lines changed Expand file tree Collapse file tree 3 files changed +40
-26
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,18 @@ export default defineComponent({
2929 const { name, size, color, classPrefix } = this
3030
3131 return (
32- < i class = { `${ classPrefix } ${ classPrefix } -${ name } ` } style = { {
33- fontSize : size ,
34- color
35- } } > </ i >
32+ < >
33+ {
34+ / ^ ( ( h t t p s ? ) : ) ? \/ \/ / . test ( name )
35+ ? < img src = { name } alt = { name . split ( '/' ) [ name . split ( '/' ) . length - 1 ] } style = { {
36+ width : size
37+ } } />
38+ : < i class = { `${ classPrefix } ${ classPrefix } -${ name } ` } style = { {
39+ fontSize : size ,
40+ color
41+ } } > </ i >
42+ }
43+ </ >
3644 )
3745 }
3846} )
Original file line number Diff line number Diff line change 1212
1313### 基本用法
1414
15- <d-icon name =" emoji " ></d-icon >
16- <d-icon name =" right " color =" #3dcca6 " ></d-icon >
17- <d-icon name =" error " color =" #f95f5b " ></d-icon >
18- <d-icon name =" ban " color =" #f95f5b " size =" 24px " ></d-icon >
15+ :::demo 通过` name ` 属性,指定需要显示的图标。
1916
20- ``` html
21- <d-icon name =" emoji" ></d-icon >
22- <d-icon name =" right" color =" #3dcca6" ></d-icon >
23- <d-icon name =" error" color =" #f95f5b" ></d-icon >
24- <d-icon name =" ban" color =" #f95f5b" size =" 24px" ></d-icon >
17+ ``` vue
18+ <d-icon name="like"></d-icon>
19+ <d-icon name="https://devui.design/components/assets/logo.svg" size="16px"></d-icon>
20+ ```
21+
22+ :::
23+
24+ ### 图标颜色
25+
26+ :::demo 通过` color ` 属性指定图标的颜色。
27+
28+ ``` vue
29+ <d-icon name="right-o" color="#50d4ab"></d-icon>
30+ <d-icon name="error-o" color="#f95f5b"></d-icon>
2531```
2632
33+ :::
34+
35+ ### 图标大小
36+
37+ :::demo 通过` size ` 属性,设置图标大小。
38+
39+ ``` vue
40+ <d-icon name="experice-new" size="32px"></d-icon>
41+ <d-icon name="experice-new" size="48px"></d-icon>
42+ ```
43+
44+ :::
45+
2746### 自定义字体图标
2847
2948Icon 组件默认引用 DevUI 图标库的图标,如果需要在现有 Icon 的基础上使用更多图标,可以引入第三方 iconfont 对应的字体文件和 CSS 文件,之后就可以在 Icon 组件中直接使用。
Original file line number Diff line number Diff line change 114114 }
115115 })
116116</script>
117-
118-
119- <style lang="scss">
120- @import '@devui/styles-var/devui-var.scss';
121- .devui-tbody tr {
122- &:nth-child(2n) {
123- background-color: $devui-global-bg-normal;
124- }
125- &:hover {
126- background-color: $devui-list-item-hover-bg;
127- }
128- }
129- </style>
130117```
131118
132119:::
You can’t perform that action at this time.
0 commit comments