Files
mes-ui-d2/src/pages/demo/components/countup/index.vue
liyang 0e61d7cee9 business
Former-commit-id: 61b3ce81f703f3b83d29c7ec9f1f58ac351e9feb [formerly 85631772690b91e0d39e1b9e90d23dae7d929c9a] [formerly 61b3ce81f703f3b83d29c7ec9f1f58ac351e9feb [formerly 85631772690b91e0d39e1b9e90d23dae7d929c9a] [formerly 61b3ce81f703f3b83d29c7ec9f1f58ac351e9feb [formerly 85631772690b91e0d39e1b9e90d23dae7d929c9a] [formerly 85631772690b91e0d39e1b9e90d23dae7d929c9a [formerly 8194f7e92144427b7c4947a93812a1cd0564a642 [formerly f4b7b47afbed6f98890de3ee269cbeae522f819e]]]]]
Former-commit-id: ea4bebdc76ac4332d037f141867abe2d88211643
Former-commit-id: 2be71d915c7aca35f87f3cd91b313a4e1d92fdc5
Former-commit-id: cf55d88b39e1f3293deada0f7294e9938a15667b [formerly 19d9709c2a3c71a1a4cf268f80ebcaff05a6c97d]
Former-commit-id: e8c7b6443a38f5d4311d19a8ecf9d5a65a5e3cd2
Former-commit-id: c68ed1fe39857770bef0feb198d6c8ab55a97959
Former-commit-id: cad71a8eb5306a6303be52cd6eed4021c16c93b6
Former-commit-id: 22d6241afd1762a0f999c89dcb24052504660e82
Former-commit-id: 3a183f17d724638f25c5f5ea70a368cdc3cd4f85
2018-11-17 11:16:07 +08:00

95 lines
2.3 KiB
Vue

<template>
<d2-container :filename="filename" type="card" class="page">
<template slot="header">数字动画组件</template>
<el-row :gutter="20">
<el-col :span="6">
<el-card shadow="never" class="d2-card d2-mb">
<p slot="title">只设置目标数字</p>
<div class="group">
<d2-count-up :end="100"/>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="never" class="d2-card d2-mb">
<p slot="title">设置起止数值</p>
<div class="group">
<d2-count-up :start="14" :end="100"/>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="never" class="d2-card d2-mb">
<p slot="title">小数位数</p>
<div class="group">
<d2-count-up :end="100" :decimals="2"/>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="never" class="d2-card d2-mb">
<p slot="title">动画时长</p>
<div class="group">
<d2-count-up :end="100" :duration="6"/>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="never" class="d2-card">
<p slot="title">回调函数</p>
<div class="group">
<d2-count-up :end="100" :callback="() => {className = 'end'}" :class="className"/>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="never" class="d2-card d2-mb-0">
<p slot="title">结束一秒后更新数值</p>
<div class="group">
<d2-count-up :end="end" :callback="update"/>
</div>
</el-card>
</el-col>
</el-row>
</d2-container>
</template>
<script>
export default {
data () {
return {
// 回调函数使用
className: '',
// 更新数值用
end: 50
}
},
methods: {
update () {
setTimeout(() => {
this.end = 100
}, 1000)
}
}
}
</script>
<style lang="scss" scoped>
.page {
.group {
display: flex;
justify-content: center;
align-items: center;
span {
font-size: 60px;
&.end {
padding: 0px 20px;
border-radius: 4px;
background-color: $color-success;
color: #FFF;
}
}
}
}
</style>