Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
vue-canvas-countdown
Advanced tools
a cool && nice countdown timer component (canvas used) for vue2.x
vue + canvas实现炫酷时钟倒计时效果的vue插件。移动端友好。
说明:此gif清晰度很低,因为转成gif图的时候,质量受损,帧数减少,所以倒计时转到红色时候看起来变的很模糊。但是实际在浏览器上效果全程都是很清晰和连贯的
说明:由于git图清晰度低,辅助用以下几张高清截图展示效果
npm install vue-canvas-countdown --save-dev
import countDown from 'vue-canvas-countdown'
const countDown = require('vue-canvas-countdown')
<template>
<div id="app" @click="fireCD">
<div class="demo">
<countDown
ref="countDown"
:fire="fire"
time="15"
:tiping="tiping"
:tipend="tipend"
@onStatusChange="onStatusChange"
@onEnd="onEnd"/>
</div>
</div>
</template>
<script>
import countDown from 'vue-canvas-countdown'
export default {
name: 'App',
components: {
countDown
},
data () {
return {
fire: 0,
tiping: {
text: '倒计时进行中',
color: '#fff'
},
tipend: {
text: '倒计时结束',
color: '#fff'
}
}
},
methods: {
fireCD () {
// 配置参数(更多配置如下表)
this.tiping = {
text: '请下注',
color: '#fff'
}
this.tipend = {
text: '停止下注',
color: '#fff'
}
// 启动倒计时(效果如上图所示)
// 也支持:this.$refs.countDown.startCd()方式 启动倒计时
this.fire++
},
onStatusChange (payload) {
console.log('倒计时状态改变:', payload)
},
onEnd () {
console.log('倒计时结束的回调函数')
}
}
}
</script>
属性 | 可选 | 类型 | 单位 | 默认值 | 备注 |
---|---|---|---|---|---|
fire: | 必选 | [Number] | - | 200 | 在父组件this.fire++ 即可启动倒计时(也支持:ref组件引用调用startCd方法启动倒计时) |
width,height: | 可选 | [Number] | px | 200 200 | 设置宽高 |
bgCir: | 可选 | [String] | - | rgba(0, 0, 0, .6) | 倒计时圆盘背景颜色 |
time: | 可选 | [Number] | 秒/s | 15 | 倒计时所用 |
statusChange: | 可选 | [Array] | 毫秒/ms | [10000, 500] | 倒计时状态改变的时机/时间点(绿=>黄=>红) |
tiping: | 可选 | [Object] | - | {text: '倒计时', color: '#fff'} | 倒计时进行时的静态文本内容和颜色(注意:color和text都得设置) |
tipend: | 可选 | [Object] | - | {text: 'END', color: '#fff'} | 倒计时结束时的静态文本内容和颜色(注意:color和text都得设置) |
事件名 | 方法说明 | 参数说明 |
---|---|---|
onStatusChange: | 倒计时状态的变化:从开启->第一次加快->第二次加快->结束 (使用场景:例如给倒计时在不同状态添加音效) | 0倒计时未启动/结束, 1开始倒计时, 2倒计时第一次加快, 3倒计时第二次加快 |
onEnd: | 倒计时结束 | 等价于 onStatusChange事件0的状态 |
welcome your issue and PR
FAQs
A Vue.js component (canvas实现类似时钟的倒计时效果)
The npm package vue-canvas-countdown receives a total of 0 weekly downloads. As such, vue-canvas-countdown popularity was classified as not popular.
We found that vue-canvas-countdown 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.