最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue中的數(shù)字滾動(dòng)和翻牌器

 更新時(shí)間:2023年10月21日 09:59:07   作者:小矮馬  
這篇文章主要介紹了vue中的數(shù)字滾動(dòng)和翻牌器,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

1、數(shù)字滾動(dòng)vue-count-to

(1)安裝:

npm install vue-count-to

(2)使用:

<template>
    <div>
        <h2>數(shù)字滾動(dòng)動(dòng)畫:</h2>
        <CountTo :start-val="startVal" :end-val="endVal" :duration="2500" class="count-number"></CountTo>
    </div>
</template>
 
<script>
    import CountTo from 'vue-count-to'
    export default {
        components: {
            CountTo
        },
        data() {
            return {
                startVal: 0,
                endVal: 2017
            }
        }
</script>

(3)說明:

參考鏈接:http://panjiachen.github.io/countTo/demo/

2、翻牌器組件

(1)組件:

<template>
    <div class="count-flop" :key="compKey">
        <div :class="item!='.'?'count-flop-box':'count-flop-point'" v-for="(item, index) in value" :key="index">
            <div v-if="item!='.'" class="count-flop-content" :class="['rolling_' + item]">
                <div v-for="(item2,index2) in numberList" :key="index2" class="count-flop-num">{{item2}}</div>
            </div>
            <div v-else class="count-flop-content">.</div>
        </div>
        <div v-if="suffix" class="count-flop-unit">{{suffix}}</div>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                value: [],
                numberList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
                compKey: 0
            };
        },
        props: ["val","suffix"],
        watch: {
            val() {
                this.value = this.val.toString().split("");
                this.compKey += 1;
            }
        },
        created() {
            this.value = this.val.toString().split("");
        },
    };
</script>
<style scoped>
    .count-flop {
        display: inline-block;
        font-size: 0;
        /* 可更改 */
        height: 50px;
        line-height: 50px;
        font-size: 36px;
        color: #4898f1;
    }
 
    .count-flop > div {
        position: relative;
        display: inline-block;
        overflow: hidden;
        height: 100%;
    }
 
    .count-flop-box {
        /* 可更改 */
        margin-right: 5px;
        width: 36px;
        border: 1px solid rgba(72, 152, 241, 0.3);
        line-height: 48px;
        border-radius: 6px;
    }
 
    .count-flop-point {
        /* 可更改 */
        margin-right: 5px;
        width: 10px;
    }
 
    .count-flop-content {
        font-family: MicrosoftYaHei-Bold;
        text-align: center;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        animation-fill-mode: forwards !important;
    }
 
    .rolling_0 {
        animation: rolling_0 2.1s ease;
    }
 
    @keyframes rolling_0 {
        from {
            transform: translateY(-90%);
        }
        to {
            transform: translateY(0);
        }
    }
 
    .rolling_1 {
        animation: rolling_1 3s ease;
    }
 
    @keyframes rolling_1 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-10%);
        }
    }
 
    .rolling_2 {
        animation: rolling_2 2.1s ease;
    }
 
    @keyframes rolling_2 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-20%);
        }
    }
 
    .rolling_3 {
        animation: rolling_3 3s ease;
    }
 
    @keyframes rolling_3 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-30%);
        }
    }
 
    .rolling_4 {
        animation: rolling_4 2.1s ease;
    }
 
    @keyframes rolling_4 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-40%);
        }
    }
 
    .rolling_5 {
        animation: rolling_5 3s ease;
    }
 
    @keyframes rolling_5 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-50%);
        }
    }
 
    .rolling_6 {
        animation: rolling_6 2.1s ease;
    }
 
    @keyframes rolling_6 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-60%);
        }
    }
 
    .rolling_7 {
        animation: rolling_7 3.1s ease;
    }
 
    @keyframes rolling_7 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-70%);
        }
    }
 
    .rolling_8 {
        animation: rolling_8 2.1s ease;
    }
 
    @keyframes rolling_8 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-80%);
        }
    }
 
    .rolling_9 {
        animation: rolling_9 3.6s ease;
    }
 
    @keyframes rolling_9 {
        from {
            transform: translateY(0);
        }
        to {
            transform: translateY(-90%);
        }
    }
</style>

 (2)調(diào)用:

<template>
    <div>
        <h2>翻牌器動(dòng)畫:</h2>
        <CountFlop :val="val" />
 
        <h2>翻牌器自定義樣式:</h2>
        <div class="myself">
            <CountFlop :val="val2" suffix="rmb" />
        </div> 
    </div> 
</template>
 
<script>
    import CountFlop from '@/components/CountFlop.vue'
    export default {
        components: {
            CountFlop,
        },
        data() {
            return {
                val: 2017,
                val2: 16.6,
            }
        }
    }
</script>
 
<style scoped lang="less">
    .myself {
        height: 32px;
        /deep/ .count-flop {
            height: 32px;
            line-height: 32px;
            font-size: 36px;
            color: red;
        }
        /deep/ .count-flop-box {
            margin-right: 0;
            width: 22px;
            border: 0;
            border-radius: 0;
            line-height: 32px;
        }
        /deep/ .count-flop-point {
            margin-right: 0;
        }
        /deep/ .count-flop-unit {
            font-size: 25px;
        }
    }
</style>

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 詳解vue數(shù)據(jù)渲染出現(xiàn)閃爍問題

    詳解vue數(shù)據(jù)渲染出現(xiàn)閃爍問題

    本篇文章主要介紹了vue數(shù)據(jù)渲染出現(xiàn)閃爍問題,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06
  • 解決vue v-for 遍歷循環(huán)時(shí)key值報(bào)錯(cuò)的問題

    解決vue v-for 遍歷循環(huán)時(shí)key值報(bào)錯(cuò)的問題

    今天小編就為大家分享一篇解決vue v-for 遍歷循環(huán)時(shí)key值報(bào)錯(cuò)的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • vue-router 4使用實(shí)例詳解

    vue-router 4使用實(shí)例詳解

    雖然 vue-router 4 大多數(shù) API 保持不變,但是在 vue3 中以插件形式存在,所以在使用時(shí)有一定的變化。接下來就學(xué)習(xí)學(xué)習(xí)它是如何使用的
    2021-11-11
  • vue3中如何使用vue-types

    vue3中如何使用vue-types

    vue-types 在 Vue 3 中的使用主要適用于希望進(jìn)行更細(xì)致的 prop 驗(yàn)證的場(chǎng)景,尤其是在 JavaScript 項(xiàng)目中,這篇文章給大家介紹vue3中如何使用vue-types,感興趣的朋友跟隨小編一起看看吧
    2024-04-04
  • Vue.js中v-for指令的用法介紹

    Vue.js中v-for指令的用法介紹

    這篇文章介紹了Vue.js中v-for指令的用法,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-03-03
  • VUE動(dòng)態(tài)生成word的實(shí)現(xiàn)

    VUE動(dòng)態(tài)生成word的實(shí)現(xiàn)

    這篇文章主要介紹了VUE動(dòng)態(tài)生成word的實(shí)現(xiàn),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • Axios學(xué)習(xí)筆記之使用方法教程

    Axios學(xué)習(xí)筆記之使用方法教程

    axios是用來做數(shù)據(jù)交互的插件,最近正在學(xué)習(xí)axios,所以想著整理成筆記方便大家和自己參考學(xué)習(xí),下面這篇文章主要跟大家介紹了關(guān)于Axios使用方法的相關(guān)資料,需要的朋友們下面來一起看看吧。
    2017-07-07
  • uniapp前端實(shí)現(xiàn)微信支付功能全過程(小程序、公眾號(hào)H5、app)

    uniapp前端實(shí)現(xiàn)微信支付功能全過程(小程序、公眾號(hào)H5、app)

    這篇文章主要介紹了uniapp前端實(shí)現(xiàn)微信支付功能的相關(guān)資料,通過uniapp開發(fā)跨平臺(tái)應(yīng)用時(shí),需要處理不同平臺(tái)的支付方式,包括微信小程序支付、公眾號(hào)H5支付和App支付,需要的朋友可以參考下
    2024-09-09
  • vue中methods、mounted等的使用方法解析

    vue中methods、mounted等的使用方法解析

    這篇文章主要介紹了vue中methods、mounted等的使用方法解析,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • mpvue將vue項(xiàng)目轉(zhuǎn)換為小程序

    mpvue將vue項(xiàng)目轉(zhuǎn)換為小程序

    這篇文章主要介紹了mpvue將vue項(xiàng)目轉(zhuǎn)換為小程序的相關(guān)資料及mpvue開發(fā)流程,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-09-09

最新評(píng)論

湘潭县| 磴口县| 武山县| 鹰潭市| 米脂县| 交口县| 包头市| 专栏| 洛浦县| 昭苏县| 塔城市| 水城县| 始兴县| 崇明县| 高雄县| 合阳县| 珠海市| 铁岭市| 新晃| 广东省| 邓州市| 洛川县| 崇仁县| 健康| 禹城市| 塔城市| 铜陵市| 比如县| 登封市| 中宁县| 句容市| 永川市| 延安市| 常州市| 浠水县| 泽库县| 上虞市| 株洲市| 江安县| 姚安县| 华池县|