Skip to content

Commit

Permalink
feat: add NaiveUIComponent page
Browse files Browse the repository at this point in the history
  • Loading branch information
flingyp committed Nov 1, 2023
1 parent 8533086 commit ad11c40
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 3 deletions.
3 changes: 3 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ declare module '@vue/runtime-core' {
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NInput: typeof import('naive-ui')['NInput']
NInputGroup: typeof import('naive-ui')['NInputGroup']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
Expand All @@ -75,9 +76,11 @@ declare module '@vue/runtime-core' {
NMenu: typeof import('naive-ui')['NMenu']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NPopover: typeof import('naive-ui')['NPopover']
NSelect: typeof import('naive-ui')['NSelect']
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
NTag: typeof import('naive-ui')['NTag']
RenderIconify: typeof import('./src/components/common/RenderIconify.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand Down
3 changes: 2 additions & 1 deletion src/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"commonGeneralAdministrator": "普通管理员",
"commonButtonPermissionManagement": "按钮权限管理",
"commonLogicFlow": "流程图",
"commonWatermark": "水印"
"commonWatermark": "水印",
"commonNaiveUIComponent": "常见组件"
},
"setting": {
"systemSetting": "系统设置",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"commonGeneralAdministrator": "General Administrator",
"commonButtonPermissionManagement": "Button Permission Management",
"commonLogicFlow": "LogicFlow",
"commonWatermark": "Watermark"
"commonWatermark": "Watermark",
"commonNaiveUIComponent": "Commo Components"
},
"setting": {
"systemSetting": "System Setting",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"commonGeneralAdministrator": "일반 관리자",
"commonButtonPermissionManagement": "버튼 권한 관리",
"commonLogicFlow": "논리 흐름",
"commonWatermark": "워터마크"
"commonWatermark": "워터마크",
"commonNaiveUIComponent": "공통 구성 요소"
},
"setting": {
"systemSetting": "시스템 설정",
Expand Down
9 changes: 9 additions & 0 deletions src/router/modules/constant-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ export const CONSTANT_ROUTES: VAdmireRoute[] = [
icon: 'la:500px',
},
},
{
path: 'naive_component',
name: 'Common_NaiveUIComponent',
component: '~/views/common/NaiveUIComponent.vue',
meta: {
text: '$t("route.commonNaiveUIComponent")',
icon: 'radix-icons:component-1',
},
},
],
},
{
Expand Down
172 changes: 172 additions & 0 deletions src/views/common/NaiveUIComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<script setup lang="ts">
import { useMessage } from 'naive-ui'
const message = useMessage()
const dateValue = ref(new Date().getTime())
const dateRangeArr = ref<[number, number]>([1183135260000, new Date().getTime()])
const inputValue = ref('')
const info = () => {
message.info(
"I don't know why nobody told you how to unfold your love",
{
keepAliveOnHover: true,
},
)
}
const error = () => {
message.error('Once upon a time you dressed so fine')
}
const warning = () => {
message.warning('How many roads must a man walk down')
}
const success = () => {
message.success(
"'Cause you walked hand in hand With another man in my place",
)
}
const loading = () => {
message.loading(
'If I were you, I will realize that I love you more than any other guy',
)
}
</script>

<template>
<div class="grid grid-cols-2 gap-8">
<NCard title="按钮 Button">
<div class="space-x-4">
<NButton>Default</NButton>
<NButton type="tertiary">
Tertiary
</NButton>
<NButton type="primary">
Primary
</NButton>
<NButton type="info">
Info
</NButton>
<NButton type="success">
Success
</NButton>
<NButton type="warning">
Warning
</NButton>
<NButton type="error">
Error
</NButton>
</div>
</NCard>
<NCard title="标签 Tag">
<div class="space-x-4">
<NTag> 爱在西元前 </NTag>
<NTag type="success">
不该
</NTag>
<NTag type="warning">
超人不会飞
</NTag>
<NTag type="error">
手写的从前
</NTag>
<NTag type="info">
哪里都是你
</NTag>
</div>
</NCard>
<NCard title="日期选择器 Date Picker">
<div class="grid grid-cols-2 gap-4">
<NDatePicker
v-model:value="dateValue"
type="date"
/>
<NDatePicker
v-model:value="dateRangeArr"
type="daterange"
clearable
/>
<NDatePicker
v-model:value="dateRangeArr"
type="quarterrange"
clearable
/>
<NDatePicker
type="datetimerange"
clearable
default-time="13:22:11"
/>
</div>
</NCard>
<NCard title="文本输入 Input">
<div class="space-y-4">
<NInput
v-model:value="inputValue"
type="text"
placeholder="基本的 Input"
/>
<NInput
v-model:value="inputValue"
type="textarea"
placeholder="基本的 Textarea"
/>
<NInputGroup>
<NInput :style="{ width: '33%' }" />
<NInputNumber :style="{ width: '33%' }" />
<NInput :style="{ width: '33%' }" />
</NInputGroup>
</div>
</NCard>
<NCard title="信息 Message">
<div class="space-x-4">
<NButton @click="info">
信息(Hover不消失)
</NButton>
<NButton @click="error">
错误
</NButton>
<NButton @click="warning">
警告
</NButton>
<NButton @click="success">
成功
</NButton>
<NButton @click="loading">
加载中
</NButton>
</div>
</NCard>
<NCard title="弹出信息 Popover">
<div class="space-x-4">
<NPopover trigger="hover">
<template #trigger>
<n-button>悬浮</n-button>
</template>
<span>I wish they all could be California girls</span>
</NPopover>
<NPopover
trigger="hover"
:keep-alive-on-hover="false"
>
<template #trigger>
<n-button>悬浮(忽略主体)</n-button>
</template>
<span>I wish they all could be California girls</span>
</NPopover>
<NPopover trigger="click">
<template #trigger>
<n-button>点击</n-button>
</template>
<span>I wish they all could be California girls</span>
</NPopover>
<NPopover trigger="focus">
<template #trigger>
<n-button>聚焦</n-button>
</template>
<span>I wish they all could be California girls</span>
</NPopover>
</div>
</NCard>
</div>
</template>

0 comments on commit ad11c40

Please sign in to comment.