JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2887
  • Score
    100M100P100Q114556F
  • License MIT

vue-count-to 支持vue2、vue3版本

Package Exports

  • vue3-count-to

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue3-count-to) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue3-count-to

基于 vue-count-to 升级改造

预览

在线预览

目的

  • 由于原有作者好像没打算升级版本,故而自己升级维护一下。

兼容

  • 当前版本同时兼容 vue2、vue3,亦能在ts下使用

安装 && 引入

  • 安装
npm install vue3-count-to --save
  • 全局注册
import countTo from 'vue3-count-to';

使用 Vue 2:

Vue.use(countTo);

使用 Vue 3:

import { createApp } from 'vue';

const app = createApp(...);

app.use(countTo);

局部引入

<template>
  <count-to></count-to>
</template>

<script>
import { CountTo } from 'vue3-count-to';

export default {
  components: {
    CountTo
  }
}
</script>
  • 浏览器引用
<script src="https://unpkg.com/vue"></script>
<!-- or -->
<script src="https://unpkg.com/vue@next"></script>
<script src="https://unpkg.com/vue3-count-to"></script>

<script>
// vue2,window 环境会默认注入vue3-count-to
new window.Vue({
  el: '#app',
  template: "<count-to></count-to>"
})

// vue3
const app = window.Vue.createApp({
  template: "<count-to></count-to>"
});

app.use(window.countTo).mount('#app');
</script>

文档

参看 vue-count-to 文档。