Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat: 基础件demo (feat #137) (#212)
Browse files Browse the repository at this point in the history
* wip: 基础组件demo。(wip #137)

* feat: 基础件demo。 (feat #137)

---------

Co-authored-by: sunHsl <sun20001016@gmail.com>
  • Loading branch information
sunHsl and sunHsl authored Oct 26, 2023
1 parent 960ac03 commit 9c990e3
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 5 deletions.
6 changes: 6 additions & 0 deletions apps/admin/src/pages/demo/Basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script lang="ts" setup>
import { Basic } from '@vben/demo'
</script>
<template>
<Basic />
</template>
1 change: 1 addition & 0 deletions packages/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { default as BasicTable } from './src/Table/basic.vue'
export { default as FixedColumn } from './src/Table/fixedColumn.vue'
export { default as TreeTable } from './src/Table/TreeTable.vue'
export { default as Modal } from './src/Modal/index.vue'
export { default as Basic } from './src/Basic/index.vue'
77 changes: 77 additions & 0 deletions packages/demo/src/Basic/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<script lang="ts" setup>
const buttonColors = [
'default',
'tertiary',
'primary',
'info',
'success',
'warning',
'error',
]
const buttonTypes = [
{
type: '基础按钮',
value: '',
},
{
type: '圆角按钮',
value: 'round',
},
{
type: '次要按钮',
value: 'secondary',
},
{
type: '次次要按钮',
value: 'tertiary',
},
{
type: '次次次要按钮',
value: 'quaternary',
},
{
type: '虚线按钮',
value: 'dashed',
},
{
type: '透明背景',
value: 'ghost',
},
]
</script>

<template>
<div class="p-2 h-full">
<VbenCard>
<h2>基础组件</h2>
<p>
基础组件依赖于Naive-UI,组件库已有的基础组件,项目中不会再次进行demo展示(二次封装组件除外)。
<VbenButton
text
tag="a"
href="https://www.naiveui.com/zh-CN/os-theme/components/button"
target="_blank"
type="primary"
>
Naive-UI
</VbenButton>
</p>
</VbenCard>
<VbenCard class="mt-3">
<div v-for="buttonType in buttonTypes" :key="buttonType.value">
<h3>{{ buttonType.type }}</h3>
<VbenButton
class="mx-2"
v-for="buttonColor in buttonColors"
:[buttonType.value]="buttonType.value"
:key="buttonColor"
:type="buttonColor"
>{{ buttonColor }}</VbenButton
>
</div>
</VbenCard>
</div>
</template>

<style lang="less" scoped></style>
1 change: 1 addition & 0 deletions packages/locale/src/lang/en/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
analysis: 'Analysis',
},
demo: {
basic: 'Basic',
demo: 'Demo',
card: 'Card',
form: 'Form',
Expand Down
1 change: 1 addition & 0 deletions packages/locale/src/lang/zh-CN/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
analysis: '分析页',
},
demo: {
basic: '基础组件',
demo: '组件',
card: '卡片',
form: '表单',
Expand Down
18 changes: 13 additions & 5 deletions packages/router/src/routes/modules/demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const dashboard: RouteRecordItem = {
root: true,
},
children: [
{
path: 'basic',
name: 'Basic',
component: () => import('@/pages/demo/Basic.vue'),
meta: {
title: 'routes.demo.basic',
},
},
{
path: 'table',
name: 'Table',
Expand Down Expand Up @@ -41,9 +49,9 @@ const dashboard: RouteRecordItem = {
name: 'TreeTable',
component: () => import('@/pages/demo/table/TreeTable.vue'),
meta: {
title: 'routes.demo.table.treeTable'
}
}
title: 'routes.demo.table.treeTable',
},
},
],
},

Expand All @@ -60,8 +68,8 @@ const dashboard: RouteRecordItem = {
name: 'Modal',
component: () => import('@/pages/demo/Modal.vue'),
meta: {
title: 'routes.demo.modal'
}
title: 'routes.demo.modal',
},
},
{
path: 'card',
Expand Down

0 comments on commit 9c990e3

Please sign in to comment.