当前位置: 首页 > news >正文

保姆级使用Vue-count-to

安装

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,但是这个好像用不了,我当时试了,并没有加载出来,而且也没报错,还有待研究

http://www.lryc.cn/news/231986.html

相关文章:

  • install YAPI MongoDB 备份mongo 安装yapi插件cross-request 笔记
  • 无线WiFi安全渗透与攻防(N.4)WPA-hashcat渗透
  • 使用VSCode进行Python模块调试
  • 【数据结构高阶】二叉搜索树
  • 如何设计短域名系统
  • web缓存-----squid代理服务
  • nginx-location和proxy_pass的url拼接
  • 从零开始配置离线服务器
  • Spring事务和事务的传播机制
  • 软件开发提效工具——低代码(Low-Code)
  • 菜单栏管理软件 Bartender 3 mac中文版功能介绍
  • ef core code first pgsql
  • 容器化nacos部署并实现服务发现(gradle)
  • 金融行业如何数字化转型?_光点科技
  • 【LeetCode刷题-滑动窗口】--1695.删除子数组的最大得分
  • iOS OpenGL ES3.0入门实践
  • 网络基础(一)
  • SQLServer添加Oracle链接服务器
  • 2017年计网408
  • UE5中APlayerController属性与方法列表(翻译中......)
  • TCP连接保活机制
  • centos安装mysql8.0.20、tar包安装方式
  • k8s yaml文件含义
  • ProEasy机器人:运动+通讯相关说明
  • Visual Studio Code 配置 C/C++ 开发环境的最佳实践(VSCode + Clangd + CMake)
  • 年产200万件的超级工厂投产!巨头「闭环」汽车电子全产业链
  • 智能穿戴AR眼镜主板方案定制_MTK平台AR智能眼镜PCB板开发
  • 【入门Flink】- 11Flink实现动态TopN
  • 现在做跨境电商还需要全球代理IP吗?全球代理IP哪家靠谱?
  • 微服务的常用组件