Skip to content

Commit

Permalink
feat: 增加NDataTable示例
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmao88 committed Aug 5, 2024
1 parent 9f1773e commit 4823c18
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/web-naive/src/locales/langs/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"page": {
"demos": {
"title": "Demos",
"naive": "Naive UI"
"naive": "Naive UI",
"table": "Table"
}
}
}
3 changes: 2 additions & 1 deletion apps/web-naive/src/locales/langs/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"page": {
"demos": {
"title": "演示",
"naive": "Naive UI"
"naive": "Naive UI",
"table": "Table"
}
}
}
9 changes: 9 additions & 0 deletions apps/web-naive/src/router/routes/modules/demos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ const routes: RouteRecordRaw[] = [
path: '/demos/naive',
component: () => import('#/views/demos/naive/index.vue'),
},
{
meta: {
icon: 'mdi:shield-key-outline',
title: $t('page.demos.table'),
},
name: 'Table',
path: '/demos/table',
component: () => import('#/views/demos/table/index.vue'),
},
],
},
];
Expand Down
31 changes: 31 additions & 0 deletions apps/web-naive/src/views/demos/table/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { ref } from 'vue';
import { NDataTable } from 'naive-ui';
const columns = ref([
{
key: 'no',
title: 'No',
},
{
key: 'title',
title: 'Title',
},
{
key: 'length',
title: 'Length',
},
]);
const data = [
{ length: '4:18', no: 3, title: 'Wonderwall' },
{ length: '4:48', no: 4, title: "Don't Look Back in Anger" },
{ length: '7:27', no: 12, title: 'Champagne Supernova' },
];
</script>

<template>
<NDataTable :columns="columns" :data="data" />
</template>

<style scoped></style>

0 comments on commit 4823c18

Please sign in to comment.