Skip to content

Commit f72a531

Browse files
authored
refactor(list): 封装List组件基础样式 (#236)
1 parent 3483121 commit f72a531

File tree

6 files changed

+88
-0
lines changed

6 files changed

+88
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { App } from 'vue';
2+
import List from './src/list';
3+
import ListItem from './src/list-item';
4+
5+
export { List, ListItem };
6+
7+
export default {
8+
title: 'List 列表',
9+
category: '数据展示',
10+
status: '10%',
11+
install(app: App): void {
12+
app.component(List.name, List);
13+
app.component(ListItem.name, ListItem);
14+
},
15+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@import '../../styles-var/devui-var.scss';
2+
3+
.devui-list-item {
4+
display: flex;
5+
align-items: center;
6+
width: 100%;
7+
height: 36px;
8+
padding: 0 8px;
9+
color: $devui-text;
10+
box-sizing: border-box;
11+
cursor: pointer;
12+
transition:
13+
color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth,
14+
background-color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth;
15+
16+
&:hover {
17+
color: $devui-list-item-hover-text;
18+
background-color: $devui-list-item-hover-bg;
19+
}
20+
21+
&:active {
22+
color: $devui-list-item-active-text;
23+
background-color: $devui-list-item-hover-bg;
24+
}
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineComponent } from 'vue';
2+
import './list-item.scss';
3+
4+
export default defineComponent({
5+
name: 'DListItem',
6+
setup(props, { slots }) {
7+
return () => <div class='devui-list-item'>{slots.default?.()}</div>;
8+
},
9+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@import '../../styles-var/devui-var.scss';
2+
3+
.devui-list {
4+
padding-bottom: 4px;
5+
border-radius: $devui-border-radius;
6+
box-sizing: border-box;
7+
background-clip: padding-box;
8+
background-color: $devui-connected-overlay-bg;
9+
outline: none;
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineComponent } from 'vue';
2+
import './list.scss';
3+
4+
export default defineComponent({
5+
name: 'DList',
6+
setup(props, { slots }) {
7+
return () => <div class='devui-list'>{slots.default?.()}</div>;
8+
},
9+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# List 列表
2+
3+
用于展示列表形态的一组数据。
4+
5+
### 基本用法
6+
7+
:::demo
8+
9+
```vue
10+
<template>
11+
<d-list>
12+
<d-list-item>Item 1</d-list-item>
13+
<d-list-item>Item 2</d-list-item>
14+
<d-list-item>Item 3</d-list-item>
15+
<d-list-item>Item 4</d-list-item>
16+
</d-list>
17+
</template>
18+
```
19+
20+
:::

0 commit comments

Comments
 (0)