How to encapsulate the digital flip card of vue version
This article mainly introduces the vue version of the digital flip card how to encapsulate the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this vue version of the digital flip card how to package the article will have a harvest, let's take a look.
Encapsulated vue version of digital flip
{{item2}}
Js part
Export default {props: {number:Number}, data () {return {list: [], numList: [0,1,2,3,4,5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,'.]}, mounted () {this.scroll () }, methods: {scroll () {this.list=this.number.toString () .split (''); let arr= []; this.list.forEach ((value) = > {arr.push ({num:value, top:0})}); this.list=arr Let Hei=parseFloat (getComputedStyle (document.getElementById ("dataNums")) .height); this.list.forEach ((value,index) = > {setTimeout () = > {value.top=parseFloat ((value.num*Hei) + (Hei*10));}, index*300);});}
Css style
Number {margin-bottom: 10px; text-align: center; ul {display: inline-block; height: 40px; text-align: center; li {float: left; width: 40px; height: 40px; text-align: center; margin: 04px; background: url (".. / assets/images/yuyueshf/number.png") no-repeat center / / background image background-size: 100% 100%; .dataBoc {position: relative; width: 100%; height: 100%; overflow: hidden; .tt {position: absolute; top: 0; left: 0 Width: 100%; height: 100%; span {width: 100%; height: 100%; line-height: 40px; float: left; text-align: center; font-size: 26px; color: # f64841 }} this is the end of the article on "how to encapsulate the vue version of the digital flier". Thank you for your reading! I believe you all have a certain understanding of the knowledge of "how to encapsulate the vue version of the digital flier". If you still want to learn more knowledge, you are welcome to follow the industry information channel.