forked from tusen-ai/naive-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data-table): add striped prop (tusen-ai#1591)
* feat(data-table): striped data table. * test(data-table): add striped test, only checking class. * docs(CHANGELOG, demo): add en demo docs, add CHANGELOG Co-authored-by: 07akioni <07akioni2@gmail.com>
- Loading branch information
1 parent
33a7f94
commit cbd0703
Showing
9 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ virtual | |
custom-filter-menu | ||
tree | ||
flex-height | ||
striped | ||
``` | ||
|
||
## API | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Striped | ||
|
||
Using `striped` prop to make it easier to distinguish rows. | ||
|
||
```html | ||
<n-data-table :columns="columns" :data="data" :striped="true" /> | ||
``` | ||
|
||
```js | ||
import { defineComponent } from 'vue' | ||
|
||
const createColumns = () => { | ||
return [ | ||
{ | ||
type: 'selection' | ||
}, | ||
{ | ||
title: 'Name', | ||
key: 'name' | ||
}, | ||
{ | ||
title: 'Age', | ||
key: 'age' | ||
}, | ||
{ | ||
title: 'Address', | ||
key: 'address' | ||
} | ||
] | ||
} | ||
|
||
const createData = () => [ | ||
{ | ||
key: 0, | ||
name: 'John Brown', | ||
age: 32, | ||
address: 'New York No. 1 Lake Park' | ||
}, | ||
{ | ||
key: 1, | ||
name: 'Jim Green', | ||
age: 42, | ||
address: 'London No. 1 Lake Park' | ||
}, | ||
{ | ||
key: 2, | ||
name: 'Joe Black', | ||
age: 32, | ||
address: 'Sidney No. 1 Lake Park' | ||
} | ||
] | ||
|
||
export default defineComponent({ | ||
setup () { | ||
return { | ||
data: createData(), | ||
columns: createColumns() | ||
} | ||
} | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ tree | |
flex-height | ||
fixed-column-debug | ||
scroll-debug | ||
striped | ||
``` | ||
|
||
## API | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 条纹 | ||
|
||
使用 `striped` 属性渲染条纹,使得表格明暗交替。 | ||
|
||
```html | ||
<n-data-table :columns="columns" :data="data" :striped="true" /> | ||
``` | ||
|
||
```js | ||
import { defineComponent } from 'vue' | ||
|
||
const createColumns = () => { | ||
return [ | ||
{ | ||
type: 'selection' | ||
}, | ||
{ | ||
title: 'Name', | ||
key: 'name' | ||
}, | ||
{ | ||
title: 'Age', | ||
key: 'age' | ||
}, | ||
{ | ||
title: 'Address', | ||
key: 'address' | ||
} | ||
] | ||
} | ||
|
||
const createData = () => [ | ||
{ | ||
key: 0, | ||
name: 'John Brown', | ||
age: 32, | ||
address: 'New York No. 1 Lake Park' | ||
}, | ||
{ | ||
key: 1, | ||
name: 'Jim Green', | ||
age: 42, | ||
address: 'London No. 1 Lake Park' | ||
}, | ||
{ | ||
key: 2, | ||
name: 'Joe Black', | ||
age: 32, | ||
address: 'Sidney No. 1 Lake Park' | ||
} | ||
] | ||
|
||
export default defineComponent({ | ||
setup () { | ||
return { | ||
data: createData(), | ||
columns: createColumns() | ||
} | ||
} | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters