<body id="app">
<div class="amount">
<div style="display: flex;">
<span>¥</span>
<transition-group name="list" tag="p" style="position: relative;">
<div style="display: inline-block;position: absolute;" v-for="(item , index) in todayAmountComputed"
:style="{
left: index * 53 + 'px',
'transition-delay': 0.1 * index + 's'
}" :key="item + index">
{{item}}</div>
</transition-group>
</div>
</div>
</body>
<script src="https://unpkg.com/vue@next" defer></script>
* {
margin: 0px;
padding: 0px;
}
body,
html {
min-width: 1920px;
min-height: 1080px;
width: 100%;
height: 100%;
}
#app {
position: relative;
}
.amount {
color: gold;
font-size: 85px;
display: flex;
justify-content: center;
}
.list-enter-active,
.list-leave-active {
transition: transform 1s ease, opacity 1s ease;
}
.list-enter-from {
opacity: 0;
transform: translateY(50%);
}
.list-leave-to {
opacity: 0;
transform: translateY(-50%);
}
document.addEventListener('DOMContentLoaded', () => {
Vue.createApp({
data() {
return {
todayAmount: '0',
platformSales1: 4090013,
}
},
computed: {
todayAmountComputed() {
return this.todayAmount.split('');
},
},
mounted() {
setInterval(() => {
if (this.todayAmount === '0') {
this.todayAmount = '1000';
}
this.todayAmount = '' + Math.floor(Math.random() * 10000);
}, 2000);
},
}).mount('#app');
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.