新增 FaProgress 组件

This commit is contained in:
Hooray
2025-05-14 10:43:22 +08:00
parent 3cba38822c
commit 8ace4fd547
6 changed files with 79 additions and 0 deletions
+8
View File
@@ -182,6 +182,14 @@ const routes: RouteRecordRaw = {
title: '浮动面板',
},
},
{
path: 'progress',
name: 'componentExampleBuiltInProgress',
component: () => import('@/views/component_built_in_example/progress.vue'),
meta: {
title: '进度条',
},
},
{
path: 'scrollarea',
name: 'componentExampleBuiltInScrollarea',
+1
View File
@@ -34,6 +34,7 @@ declare module 'vue' {
FaPasswordStrength: typeof import('./../ui/components/FaPasswordStrength/index.vue')['default']
FaPinInput: typeof import('./../ui/components/FaPinInput/index.vue')['default']
FaPopover: typeof import('./../ui/components/FaPopover/index.vue')['default']
FaProgress: typeof import('./../ui/components/FaProgress/index.vue')['default']
FaScrollArea: typeof import('./../ui/components/FaScrollArea/index.vue')['default']
FaSearchBar: typeof import('./../ui/components/FaSearchBar/index.vue')['default']
FaSelect: typeof import('./../ui/components/FaSelect/index.vue')['default']
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { Progress } from './progress'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
const modelValue = defineModel<number>({
default: 0,
})
</script>
<template>
<Progress v-bind="props" :model-value="modelValue" />
</template>
@@ -0,0 +1,40 @@
<script setup lang="ts">
import type { ProgressRootProps } from 'reka-ui'
import type { HTMLAttributes } from 'vue'
import { cn } from '@/utils'
import {
ProgressIndicator,
ProgressRoot,
} from 'reka-ui'
import { computed } from 'vue'
const props = withDefaults(
defineProps<ProgressRootProps & { class?: HTMLAttributes['class'] }>(),
{
modelValue: 0,
},
)
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
</script>
<template>
<ProgressRoot
v-bind="delegatedProps"
:class="
cn(
'relative h-4 w-full overflow-hidden rounded-full bg-secondary',
props.class,
)
"
>
<ProgressIndicator
class="h-full w-full flex-1 bg-primary transition-all"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`"
/>
</ProgressRoot>
</template>
@@ -0,0 +1 @@
export { default as Progress } from './Progress.vue'
@@ -0,0 +1,13 @@
<route lang="yaml">
meta:
enabled: false
</route>
<template>
<div>
<FaPageHeader title="进度条" description="FaProgress" />
<FaPageMain>
<FaProgress :model-value="33" />
</FaPageMain>
</div>
</template>