mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-18 11:06:36 +08:00
commit:升级到vue3,更新最近工作流技术栈,支持sa-token
This commit is contained in:
36
OrangeFormsOpen-VUE3/src/components/Progress/index.vue
Normal file
36
OrangeFormsOpen-VUE3/src/components/Progress/index.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<el-progress v-bind="$attrs" :percentage="getPercentage" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/**
|
||||
* 组件最小值
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* 组件最大值
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* 组件当前值
|
||||
*/
|
||||
value?: number;
|
||||
}>(),
|
||||
{ min: 0, max: 100, value: 0 },
|
||||
);
|
||||
|
||||
const getPercentage = computed(() => {
|
||||
let value: number = Math.min(props.max, Math.max(props.min, props.value));
|
||||
value = value - props.min;
|
||||
if (props.max - props.min === 0) {
|
||||
value = 0;
|
||||
} else {
|
||||
value = (value * 100) / (props.max - props.min);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user