uni-app項目數字滾動

uni-app項目數字滾動

github地址,喜歡的可以star下哦

插件預覽圖

圖片描述

使用教程

1.插件代碼拷貝

  • 下載後把components目錄下countUp.vue文件拷貝到自己項目目錄下

2.插件全局配置

  • 在項目裏main.js中配置如下代碼
import countUp from './components/countUp.vue'

Vue.component('countup',countUp)

3.插件使用

  • vue頁面使用
<template>
    <view>
        <countup :num="num" color="#ff9e50" width='13' height='23' fontSize='23'></countup>
        <button @tap="add">Add</button>
        <button @tap="reduce">Reduce</button>
    </view>
</template>

<script>
export default {
    data() {
        return {
            num:123.453
        };
    },
    onLoad() {},
    methods: {
        add() {
            this.num=++this.num;
        },
        reduce(){
            this.num=--this.num;
        }
    }
};
</script>

兼容性

uni-app項目中使用都兼容

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章