
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
xiaohe-vue-count-to
Advanced tools
小何同学 / github@xiaohe0601 / gitee@xiaohe0601
还可以试一试在线DEMO
pnpm add xiaohe-vue-count-to
yarn add xiaohe-vue-count-to
npm install xiaohe-vue-count-to
如果
Vue
版本小于2.7
,还需要安装@vue/composition-api
pnpm add @vue/composition-api
<template>
<count-to :value="pandora">
<template #default="{ value }">
<span>{{ value }}</span>
</template>
</count-to>
</template>
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { CountTo } from "xiaohe-vue-count-to";
const pandora = ref<number>(0);
onMounted(() => {
setTimeout(() => {
pandora.value = 20000;
}, 100);
});
</script>
仅 Vue 3
可直接通过 ref
获取到 xiaohe-transition
实例用于控制动画
<template>
<count-to ref="counter" :value="pandora">
<template #default="{ value }">
<span>{{ value }}</span>
</template>
</count-to>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import type { CountToInst } from "xiaohe-vue-count-to";
import { CountTo } from "xiaohe-vue-count-to";
const counter = ref<CountToInst | null>(null);
const pandora = ref<number>(0);
/**
* 暂停
*/
function pause(): void {
counter.value?.transition.pause();
}
/**
* 继续
*/
function resume(): void {
counter.value?.transition.resume();
}
</script>
Vue 2/3
均可通过 inited
事件获取到 xiaohe-transition
实例用于控制动画
<template>
<count-to :value="pandora" @inited="onCounterInited">
<template #default="{ value }">
<span>{{ value }}</span>
</template>
</count-to>
</template>
<script>
import { CountTo } from "xiaohe-vue-count-to";
export default {
components: { CountTo },
data() {
return {
pandora: 0
};
},
created() {
this.transition = null;
},
methods: {
onCounterInited(transition) {
this.transition = transition;
},
/**
* 暂停
*/
pause() {
this.transition?.pause();
},
/**
* 继续
*/
resume() {
this.transition?.resume();
}
}
};
</script>
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
value | 数值 | NumberLike | - | 0 |
decimals | 小数位数 | NumberLike | - | 0 |
duration | 动画时长(单位: ms) | NumberLike | - | 2000 |
preset | 预设曲线 | BezierCurvePresetLike | linear/ease/ease-in/ease-out/ease-in-out | linear |
bezier | 自定义曲线(优先级高于preset) | BezierCurve | - | - |
delay | 延迟开始时间(单位: ms) | NumberLike | - | 0 |
fps | 帧率 | NumberLike | - | -1 |
decimal 0.3.0 | 小数点 | string | - | . |
use-group-value 0.3.0 | 是否启用数值分组(示例:10000000.00 -> 10,000,000.00) | boolean | - | false |
use-indian-style-group 0.3.0 | 是否使用印度风格数值分组(示例:10000000.00 -> 1,00,00,000.00) | boolean | - | false |
separator 0.3.0 | 分隔符 | string | - | , |
numerals 0.3.0 | 自定义数字 | string[] | - | - |
事件 | 说明 | 回调参数 |
---|---|---|
inited | transition 初始化完成 | (instance: Transition ) |
change | 数值变化 | (value: string , instance: Transition ) |
started | 动画开始 | (instance: Transition ) |
paused | 动画暂停 | (instance: Transition ) |
resumed | 动画继续 | (instance: Transition ) |
stopped | 动画停止 | (instance: Transition ) |
completed | 动画完成 | (instance: Transition ) |
名称 | 说明 | 类型 |
---|---|---|
default | 默认内容 | { value: string } |
属性 | 说明 | 类型 |
---|---|---|
transition | xiaohe-transition 实例 | Transition |
请查看 jsdocs.io
FAQs
⏱️ 一个实现数字平滑变化的Vue小组件
We found that xiaohe-vue-count-to demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.