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

Commit

Permalink
feat(demo): add Time demo page(时间组件-demo #140) (#311)
Browse files Browse the repository at this point in the history
Co-authored-by: jackhoo_98 <[email protected]>
  • Loading branch information
13982720426 and jackhoo_98 authored Dec 23, 2023
1 parent 4cbbbe0 commit 8601dfb
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/admin/src/pages/demo/Time.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script lang="ts" setup>
import { Time } from '@vben/demo'
</script>
<template>
<Time />
</template>
1 change: 1 addition & 0 deletions packages/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { default as Google } from './src/Charts/Google.vue'
export { default as QrCode } from './src/QrCode/index.vue'
export { default as Editor } from './src/Editor/Editor.vue'
export { default as CountTo } from './src/CountTo/index.vue'
export { default as Time } from './src/Time/index.vue'
42 changes: 42 additions & 0 deletions packages/demo/src/Time/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script lang="ts" setup>
import { reactive } from 'vue'
import { Time } from '@vben/components'
const now = new Date().getTime()
const state = reactive({
time1: now - 60 * 3 * 1000,
time2: now - 86400 * 3 * 1000,
})
</script>

<template>
<VbenCard title="时间组件示例" :bordered="false">
<VbenGrid :x-gap="12" :y-gap="8" :cols="1">
<VbenGridItem>
<VbenCard hoverable title="基础示例">
<Time :value="state.time1" />
<br />
<Time :value="state.time2" />
</VbenCard>
</VbenGridItem>
<VbenGridItem>
<VbenCard hoverable title="定时更新">
<Time :value="now" :step="1" />
<br />
<Time :value="now" :step="5" />
</VbenCard>
</VbenGridItem>
<VbenGridItem>
<VbenCard hoverable title="定时更新">
<Time :value="now" mode="date" />
<br />
<Time :value="now" mode="datetime" />
<br />
<Time :value="now" />
</VbenCard>
</VbenGridItem>
</VbenGrid>
</VbenCard>
</template>

<style lang="less" scoped></style>
9 changes: 9 additions & 0 deletions packages/locale/src/lang/en/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ export default {
normalText: 'Get SMS code',
sendText: 'Reacquire in {0}s',
},
time: {
before: ' ago',
after: ' after',
just: ' just now',
seconds: ' seconds',
minutes: ' minutes',
hours: ' hours',
days: ' days',
},
}
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 @@ -17,6 +17,7 @@ export default {
form: 'Form',
qrcode: 'QR code',
countTo: 'Count To',
time: 'Relative Time"',
table: {
table: 'table',
basic: 'basic',
Expand Down
9 changes: 9 additions & 0 deletions packages/locale/src/lang/zh-CN/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ export default {
normalText: '获取验证码',
sendText: '{0}秒后重新获取',
},
time: {
before: '前',
after: '后',
just: '刚刚',
seconds: '秒',
minutes: '分钟',
hours: '小时',
days: '天',
},
}
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 @@ -17,6 +17,7 @@ export default {
form: '表单',
qrcode: '二维码组件',
countTo: '数字动画',
time: '相对时间',
table: {
table: '表格',
basic: '基础表格',
Expand Down
8 changes: 8 additions & 0 deletions packages/router/src/routes/modules/demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ const dashboard: RouteRecordItem = {
title: 'routes.demo.countTo',
},
},
{
path: 'time',
name: 'Time',
component: () => import('@/pages/demo/Time.vue'),
meta: {
title: 'routes.demo.time',
},
},
],
}

Expand Down

0 comments on commit 8601dfb

Please sign in to comment.