vue 中使用Odometer

<template>
  <div>
    <IOdometer class="iOdometer" :value="num" format="(ddd).dd" />
  </div>
</template>

<script>
import IOdometer from "vue-odometer";
import "odometer/themes/odometer-theme-default.css";
export default {
  components: {
    IOdometer,
  },
  data() {
    return {
      num: 99.99,
    };
  },
  mounted() {
    const that = this;
    setInterval(function () {
      that.num += 1;
    }, 3000 * 30);
  },
};
</script>

<style lang='scss' scoped >
.iOdometer {
  font-size: 2em;
  margin: 0;
  ::v-deep .odometer-digit {
      display: inline-block;
           width: 28px;
      height: 34px;
      background: linear-gradient(0deg, #0e2f6d, rgba(6, 41, 106, 0));
      border: 1px solid;
      border-image: linear-gradient(
        0deg,
        rgba(0, 182, 255, 0.8),
        rgba(0, 182, 255, 0.8)
      );
      font-family: "DigifaceWide";
      text-align: center;
      color: #fff;
      margin-left: 4px;
      border-radius: 3px;
  }
  ::v-deep .odometer-formatting-mark {
      display: inline-block;
           width: 28px;
      height: 34px;
      background: linear-gradient(0deg, #0e2f6d, rgba(6, 41, 106, 0));
      border: 1px solid;
      border-image: linear-gradient(
        0deg,
        rgba(0, 182, 255, 0.8),
        rgba(0, 182, 255, 0.8)
      );
      font-family: "DigifaceWide";
      text-align: center;
      color: #fff;
      margin-left: 4px;
      border-radius: 3px;
  }

}
</style>

具体使用可以关注https://www.npmjs.com/package/vue-odometer
然后参考https://github.hubspot.com/odometer/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值