-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
163 additions
and
130 deletions.
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
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 was deleted.
Oops, something went wrong.
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,68 @@ | ||
<markdown> | ||
# Tree data | ||
|
||
Set `children` in row data to show tree data. If you want to use other key to get children, you can set another `children-key`. | ||
</markdown> | ||
|
||
<template> | ||
<n-data-table :columns="columns" :data="data" :row-key="rowKey" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { DataTableColumns } from 'naive-ui' | ||
type RowData = { | ||
name: string | ||
index: string | ||
children?: RowData[] | ||
} | ||
export default defineComponent({ | ||
setup () { | ||
const data: RowData[] = [ | ||
{ | ||
name: '07akioni', | ||
index: '07', | ||
children: [ | ||
{ | ||
name: '08akioni', | ||
index: '08', | ||
children: [ | ||
{ | ||
name: '09akioni', | ||
index: '09' | ||
}, | ||
{ | ||
name: '10akioni', | ||
index: '10' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
name: '11akioni', | ||
index: '11' | ||
} | ||
] | ||
const columns: DataTableColumns<RowData> = [ | ||
{ | ||
type: 'selection' | ||
}, | ||
{ | ||
title: 'name', | ||
key: 'name' | ||
}, | ||
{ | ||
title: 'index', | ||
key: 'index' | ||
} | ||
] | ||
return { | ||
rowKey: (row: RowData) => row.index, | ||
columns, | ||
data | ||
} | ||
} | ||
}) | ||
</script> |
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 was deleted.
Oops, something went wrong.
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,68 @@ | ||
<markdown> | ||
# 树型数据 | ||
|
||
在行数据中设定 `children` 来展示树型数据。如果你想用别的 key 来获取 children,那么可以设定 `children-key`。 | ||
</markdown> | ||
|
||
<template> | ||
<n-data-table :columns="columns" :data="data" :row-key="rowKey" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { DataTableColumns } from 'naive-ui' | ||
type RowData = { | ||
name: string | ||
index: string | ||
children?: RowData[] | ||
} | ||
export default defineComponent({ | ||
setup () { | ||
const data: RowData[] = [ | ||
{ | ||
name: '07akioni', | ||
index: '07', | ||
children: [ | ||
{ | ||
name: '08akioni', | ||
index: '08', | ||
children: [ | ||
{ | ||
name: '09akioni', | ||
index: '09' | ||
}, | ||
{ | ||
name: '10akioni', | ||
index: '10' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
name: '11akioni', | ||
index: '11' | ||
} | ||
] | ||
const columns: DataTableColumns<RowData> = [ | ||
{ | ||
type: 'selection' | ||
}, | ||
{ | ||
title: 'name', | ||
key: 'name' | ||
}, | ||
{ | ||
title: 'index', | ||
key: 'index' | ||
} | ||
] | ||
return { | ||
rowKey: (row: RowData) => row.index, | ||
columns, | ||
data | ||
} | ||
} | ||
}) | ||
</script> |
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
Oops, something went wrong.