From 1995e710dcf70e635c4edaa8173f8b66cd67d499 Mon Sep 17 00:00:00 2001
From: 黄何裕 <1053952480@qq.com>
Date: 星期二, 30 七月 2024 14:05:06 +0800
Subject: [PATCH] 样式优化

---
 src/main.js |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/main.js b/src/main.js
index 9ede569..7baf4cc 100644
--- a/src/main.js
+++ b/src/main.js
@@ -42,6 +42,9 @@
 import VScaleScreen from 'v-scale-screen'
 import dataV from '@jiaminghi/data-view'
 
+import gsap from 'gsap';
+import { formatNumber } from './utils/format';
+
 
 
 // 鍏ㄥ眬鏂规硶鎸傝浇
@@ -55,6 +58,7 @@
 Vue.prototype.download = download
 Vue.prototype.handleTree = handleTree
 Vue.prototype.getToken = getToken
+Vue.prototype.$uploadUrl = process.env.VUE_APP_BASE_API + "/common/upload"
 
 // 鍏ㄥ眬缁勪欢鎸傝浇
 Vue.component('DictTag', DictTag)
@@ -72,6 +76,9 @@
 Vue.use(dataV)
 DictData.install()
 
+// websocket
+Vue.prototype.$websocket = null;
+
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api
@@ -87,6 +94,41 @@
 
 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,

--
Gitblit v1.8.0