保姆级使用Vue
- 保姆级使用Vue 推荐度:
- 相关推荐
保姆级使用Vue
安装
npm install vue-count-to
直接使用
<template><div class="vue-count-to"><div class="count-to"><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div><div><CountTo :startVal='startVal' :endVal='endVal' :duration='duration' /></div></div></div>
</template>
<script>
import CountTo from 'vue-count-to'
export default {data() {return {startVal: 0,endVal: 100,duration: 3000,timer: null}},components: {CountTo},mounted() {this.timer = setInterval(() => {this.endVal = this.endVal * 2}, 4000)},destroyed() {clearInterval(this.timer)}
}
</script>
<style scoped>
.vue-count-to {width: 100%;height: 100%;
}
.count-to {width: 300px;height: 300px;margin: 100px 0 0 100px;border: 1px solid red;
}
.count-to span {font-size: 30px;font-weight: 700;font-family: 'YJSZ';
}
.count-to > div:nth-of-type(1) > span {color: red;
}
.count-to > div:nth-of-type(2) > span {color: blue;
}
.count-to > div:nth-of-type(3) > span {color: pink;
}
.count-to > div:nth-of-type(4) > span {color: yellow;
}
.count-to > div:nth-of-type(5) > span {color: green;
}
.count-to > div:nth-of-type(6) > span {color: orange;
}
.count-to > div:nth-of-type(7) > span {color: cyan;
}
.count-to > div:nth-of-type(8) > span {color: purple;
}
</style>
① vue-count-to只能适用 Vue2,并不适用于Vue3;
② 对于Vue3还有个vue3-count-to,但是这个好像用不了,我当时试了,并没有加载出来,而且也没报错,还有待研究
最新文章
- 我的电脑防火墙启动不了 错误0x80070422
- 突然消失的桌面文件如何恢复?详细教程让你轻松解决问题!
- Python实现WOA智能鲸鱼优化算法优化卷积神经网络回归模型(CNN回归算法)项目实战
- 【QT进阶】第十二章QT事件的使用
- 成都爱尔谭姣主任讲解哪些情况需要进行泪道冲洗
- 4步轻松搞定烦人的WPS右键菜单
- 数据校验:Spring Validation
- 【python自动化】Playwright基础教程(八)鼠标操作
- python语法之注释
- 西门子精智屏数据记录U盘插拔问题总结
- 【人工智能Ⅰ】6
- java中的Closeable与AutoCloseable
- 【python】Django——django简介、django安装、创建项目、快速上手
- 观察者模式
- samba服务器搭建 挂载远程目录常用配置参数介绍
- 【python自动化】Playwright基础教程(七)Keyboard键盘
- AM@定积分的定义求某些类型的极限