From 6429b95aa66bfbb214bcadb248b8b7ca5e754368 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 18 一月 2026 23:17:41 +0800
Subject: [PATCH] 修改相关代码

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

diff --git a/src/main.js b/src/main.js
index da01750..e4738ac 100644
--- a/src/main.js
+++ b/src/main.js
@@ -35,7 +35,10 @@
 import DictTag from '@/components/DictTag'
 // 瀛楀吀鏁版嵁缁勪欢
 import DictData from '@/components/DictData'
+import * as echarts from 'echarts'
 
+// 鍏ㄥ眬娉ㄥ唽涓�$echarts
+Vue.prototype.$echarts = echarts
 // 鍏ㄥ眬鏂规硶鎸傝浇
 Vue.prototype.getDicts = getDicts
 Vue.prototype.getConfigKey = getConfigKey
@@ -59,7 +62,43 @@
 Vue.use(directive)
 Vue.use(plugins)
 DictData.install()
+// 鍒涘缓涓�涓嚜瀹氫箟鎸囦护
+Vue.directive('auto-height', {
+  bind(el, binding) {
+    const minRows = binding.value?.minRows || 1;
+    const maxRows = binding.value?.maxRows || 10;
 
+    const resize = () => {
+      // 閲嶇疆楂樺害
+      el.style.height = 'auto';
+
+      // 鑾峰彇鍐呭楂樺害
+      const scrollHeight = el.scrollHeight;
+      const lineHeight = parseInt(getComputedStyle(el).lineHeight);
+
+      // 璁$畻闇�瑕佺殑琛屾暟
+      let rows = Math.floor(scrollHeight / lineHeight);
+      rows = Math.max(minRows, Math.min(rows, maxRows));
+
+      // 璁剧疆琛屾暟
+      el.setAttribute('rows', rows);
+      el.style.height = `${rows * lineHeight}px`;
+    };
+
+    // 鐩戝惉杈撳叆浜嬩欢
+    el.addEventListener('input', resize);
+    // 鍒濆鍖栨椂璋冩暣涓�娆�
+    resize();
+
+    // 淇濆瓨resize鍑芥暟浠ヤ究鍗歌浇
+    el._autoHeightResize = resize;
+  },
+
+  unbind(el) {
+    el.removeEventListener('input', el._autoHeightResize);
+    delete el._autoHeightResize;
+  }
+});
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api

--
Gitblit v1.9.1