mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-21 11:06:38 +08:00
135 lines
2.9 KiB
Vue
135 lines
2.9 KiB
Vue
<template>
|
|
<n-grid :x-gap="16" :y-gap="16" :item-responsive="true" responsive="screen">
|
|
<n-grid-item span="s:24 m:8">
|
|
<shadow-card class="h-400px p-18px">
|
|
<n-timeline>
|
|
<n-timeline-item v-for="item in timelines" :key="item.type" v-bind="item" />
|
|
</n-timeline>
|
|
</shadow-card>
|
|
</n-grid-item>
|
|
<n-grid-item span="s:24 m:16">
|
|
<shadow-card class="h-400px p-18px">
|
|
<n-data-table size="small" :columns="columns" :data="tableData" />
|
|
</shadow-card>
|
|
</n-grid-item>
|
|
</n-grid>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { h } from 'vue';
|
|
import { NGrid, NGridItem, NTimeline, NTimelineItem, NDataTable, NTag } from 'naive-ui';
|
|
import { ShadowCard } from '@/components';
|
|
|
|
interface TimelineData {
|
|
type: 'default' | 'info' | 'success' | 'warning' | 'error';
|
|
title: string;
|
|
content: string;
|
|
time: string;
|
|
}
|
|
|
|
interface TableData {
|
|
key: number;
|
|
name: string;
|
|
age: number;
|
|
address: string;
|
|
tags: string[];
|
|
}
|
|
|
|
const timelines: TimelineData[] = [
|
|
{ type: 'default', title: '啊', content: '', time: '2021-10-10 20:46' },
|
|
{ type: 'success', title: '成功', content: '哪里成功', time: '2021-10-10 20:46' },
|
|
{ type: 'error', title: '错误', content: '哪里错误', time: '2021-10-10 20:46' },
|
|
{ type: 'warning', title: '警告', content: '哪里警告', time: '2021-10-10 20:46' },
|
|
{ type: 'info', title: '信息', content: '是的', time: '2021-10-10 20:46' }
|
|
];
|
|
|
|
const columns = [
|
|
{
|
|
title: 'Name',
|
|
key: 'name'
|
|
},
|
|
{
|
|
title: 'Age',
|
|
key: 'age'
|
|
},
|
|
{
|
|
title: 'Address',
|
|
key: 'address'
|
|
},
|
|
{
|
|
title: 'Tags',
|
|
key: 'tags',
|
|
render(row: TableData) {
|
|
const tags = row.tags.map(tagKey => {
|
|
return h(
|
|
NTag,
|
|
{
|
|
style: {
|
|
marginRight: '6px'
|
|
},
|
|
type: 'info'
|
|
},
|
|
{
|
|
default: () => tagKey
|
|
}
|
|
);
|
|
});
|
|
return tags;
|
|
}
|
|
}
|
|
];
|
|
|
|
const tableData: TableData[] = [
|
|
{
|
|
key: 0,
|
|
name: 'John Brown',
|
|
age: 32,
|
|
address: 'New York No. 1 Lake Park',
|
|
tags: ['nice', 'developer']
|
|
},
|
|
{
|
|
key: 1,
|
|
name: 'Jim Green',
|
|
age: 42,
|
|
address: 'London No. 1 Lake Park',
|
|
tags: ['wow']
|
|
},
|
|
{
|
|
key: 2,
|
|
name: 'Joe Black',
|
|
age: 32,
|
|
address: 'Sidney No. 1 Lake Park',
|
|
tags: ['cool', 'teacher']
|
|
},
|
|
{
|
|
key: 3,
|
|
name: 'Soybean',
|
|
age: 25,
|
|
address: 'China Shenzhen',
|
|
tags: ['handsome', 'peogrammer']
|
|
},
|
|
{
|
|
key: 4,
|
|
name: 'John Brown',
|
|
age: 32,
|
|
address: 'New York No. 1 Lake Park',
|
|
tags: ['nice', 'developer']
|
|
},
|
|
{
|
|
key: 5,
|
|
name: 'Jim Green',
|
|
age: 42,
|
|
address: 'London No. 1 Lake Park',
|
|
tags: ['wow']
|
|
},
|
|
{
|
|
key: 6,
|
|
name: 'Joe Black',
|
|
age: 32,
|
|
address: 'Sidney No. 1 Lake Park',
|
|
tags: ['cool', 'teacher']
|
|
}
|
|
];
|
|
</script>
|
|
<style scoped></style>
|