| | |
| | | import VScaleScreen from 'v-scale-screen' |
| | | import dataV from '@jiaminghi/data-view' |
| | | |
| | | import gsap from 'gsap'; |
| | | import { formatNumber } from './utils/format'; |
| | | |
| | | |
| | | |
| | | // 全局方法挂载 |
| | |
| | | |
| | | Vue.config.productionTip = true |
| | | |
| | | |
| | | // 全局指令 |
| | | Vue.directive('roll', { |
| | | inserted: (el, binding) => { |
| | | let target = { |
| | | count: 0 |
| | | }; |
| | | let finalNumber = el.innerText; |
| | | gsap.to(target, { |
| | | count: finalNumber, |
| | | duration: 1, |
| | | ease: "power2.out", |
| | | onUpdate: () => { |
| | | el.innerText = formatNumber(target.count.toFixed(0)); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | update: (el, binding) => { |
| | | let target = { |
| | | count: el.innerText |
| | | }; |
| | | let finalNumber = el.getAttribute('value'); |
| | | gsap.to(target, { |
| | | count: finalNumber, |
| | | duration: 1, |
| | | ease: "power2.out", |
| | | onUpdate: () => { |
| | | el.innerText = formatNumber(target.count.toFixed(0)); |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | new Vue({ |
| | | el: '#app', |
| | | router, |