Vue does a 30s countdown, which has a magnifying effect in the final 10s countdown.

topic description

vue does a 30s countdown and has a magnifying effect at the last 10s

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)
< template >

{{second}}

< / div >

< / template >

< script >
export default {

data () {
  return {
    seconds: 30
  }
},
mounted () {
  this.add()
},
methods: {
  num: function (n) {
    return n < 10 ? "0" + n : "" + n
  },
  add: function () {
    var _this = this
    var time = window.setInterval(function () {
      if (_this.seconds === 0 ) {
        _this.seconds = 0
      } else if ( _this.seconds === 0) {
        _this.seconds = 0
        window.clearInterval(time)
      } else {
        _this.seconds -= 1
      }
    }, 1000)
  }
},
computed: {
  second: function () {
    return this.num(this.seconds)
  },
}

}
< / script >

what result do you expect? What is the error message actually seen?

I hope the Great God will give me a method

Sep.16,2021

html

<p :class="{ zoom: isZoom }">{{second}}

js

data () {
    return {
        seconds: 30,
        isZoom: false
    }
},

methods: {
    num: function (n) {
        this.isZoom = n <= 10 && n > 0;
        return n < 10 ? '0' + n : '' + n
    },
    ...
}

css

.zoom {
    animation: test 1s infinite;
}
@keyframes test {
    from {
        font-size: 14px;
    }
    to {
        font-size: 24px;
    }
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        -sharpapp {
            text-align: center;
            padding: 100px;
        }
        -sharpapp p {
            font-size: 16px;
            transition: all 1s ease;
        }
        -sharpapp p.large {
            animation: changeSize 1s infinite;
            -webkit-animation: changeSize 1s infinite; /* Safari  Chrome */
        }
        -sharpapp p.zero {
            font-size: 22px;
        }
        @keyframes changeSize {
            0% {
                font-size: 16px;
            }
            50% {
                font-size: 22px;
            }
            100% {
                font-size: 16px;
            }
        }
        @-webkit-keyframes changeSize {
            0% {
                font-size: 16px;
            }
            50% {
                font-size: 22px;
            }
            100% {
                font-size: 16px;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <p :class="[second < 10 && second > 0 ? 'large' : '', second == 0 ? 'zero' : '']">{{second < 10 ? '0' + second : second}}

</div> <script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.min.js"></script> <script> new Vue({ el: '-sharpapp', data() { return { second: 15, timer: null } }, methods:{ setTimer() { this.timer = window.setInterval(() => { if(this.second <= 0) { window.clearInterval(this.timer) return false; } this.second--; }, 1000) } }, mounted() { this.setTimer(); }, beforeDestroy() { if(this.timer){ window.clearInterval(this.timer) } }, }) </script> </body> </html>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e469e6-44bca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e469e6-44bca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?