- npm updates - new SearchMap.vue component
This commit is contained in:
parent
7bc9f90cca
commit
a7142f694f
74 changed files with 3360 additions and 3577 deletions
|
@ -1,63 +1,61 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch, onMounted } from 'vue'
|
||||
import numeral from 'numeral'
|
||||
import { computed, ref, watch, onMounted } from 'vue';
|
||||
import numeral from 'numeral';
|
||||
|
||||
const props = defineProps({
|
||||
prefix: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
suffix: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 500
|
||||
}
|
||||
})
|
||||
prefix: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
suffix: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
},
|
||||
});
|
||||
|
||||
const newValue = ref(0)
|
||||
const newValue = ref(0);
|
||||
|
||||
const newValueFormatted = computed(
|
||||
() => newValue.value < 1000 ? newValue.value : numeral(newValue.value).format('0,0')
|
||||
)
|
||||
const newValueFormatted = computed(() => (newValue.value < 1000 ? newValue.value : numeral(newValue.value).format('0,0')));
|
||||
|
||||
const value = computed(() => props.value)
|
||||
const value = computed(() => props.value);
|
||||
|
||||
const grow = m => {
|
||||
const v = Math.ceil(newValue.value + m)
|
||||
const grow = (m) => {
|
||||
const v = Math.ceil(newValue.value + m);
|
||||
|
||||
if (v > value.value) {
|
||||
newValue.value = value.value
|
||||
return false
|
||||
}
|
||||
if (v > value.value) {
|
||||
newValue.value = value.value;
|
||||
return false;
|
||||
}
|
||||
|
||||
newValue.value = v
|
||||
newValue.value = v;
|
||||
|
||||
setTimeout(() => {
|
||||
grow(m)
|
||||
}, 25)
|
||||
}
|
||||
setTimeout(() => {
|
||||
grow(m);
|
||||
}, 25);
|
||||
};
|
||||
|
||||
const growInit = () => {
|
||||
newValue.value = 0
|
||||
grow(props.value / (props.duration / 25))
|
||||
}
|
||||
newValue.value = 0;
|
||||
grow(props.value / (props.duration / 25));
|
||||
};
|
||||
|
||||
watch(value, () => {
|
||||
growInit()
|
||||
})
|
||||
growInit();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
growInit()
|
||||
})
|
||||
growInit();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>{{ prefix }}{{ newValueFormatted }}{{ suffix }}</div>
|
||||
<div>{{ prefix }}{{ newValueFormatted }}{{ suffix }}</div>
|
||||
</template>
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue