From 1d1553dcf7144da54b3990d50f05f6fcf26df121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8A=B2=E6=9D=BE?= Date: Fri, 13 Mar 2020 13:44:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20dashboard=E9=A1=B5=E5=B7=A6=E4=B8=8A?= =?UTF-8?q?=E8=A7=92panel=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/page/dashboard/panel.vue | 4 +- nezha-fronted/src/main.js | 40 +++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 72c55c57b..c01161c7e 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -10,12 +10,12 @@
- + {{showPanel.name}} - + {{$t('dashboard.panel.createPanelTitleSec')}} diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index c102e6445..26912bd58 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -126,18 +126,22 @@ Vue.directive("scrollBar", { if (arg === "el-table") { el = el.querySelector(".el-table__body-wrapper"); !el && console.warn("未发现className为el-table__body-wrapper的dom"); - - // 启用x轴后不让原生滚动条出来作乱 - vnode.context.$nextTick(() => { - el.classList.add("ps"); - el.addEventListener("ps-scroll-y", () => - el.classList.add("ps") - ); - el.addEventListener("ps-scroll-x", () => - el.classList.add("ps") - ); - }); + } else if (arg === "el-dropdown") { + el = el.querySelector(".el-dropdown-menu"); + !el && console.warn("未发现className为el-dropdown-menu的dom"); } + + // 启用x轴后不让原生滚动条出来作乱 + vnode.context.$nextTick(() => { + el.classList.add("ps"); + el.addEventListener("ps-scroll-y", () => + el.classList.add("ps") + ); + el.addEventListener("ps-scroll-x", () => + el.classList.add("ps") + ); + }); + const rules = ["fixed", "absolute", "relative"]; if (!rules.includes(window.getComputedStyle(el, null).position)) { console.error( @@ -153,13 +157,17 @@ Vue.directive("scrollBar", { const { arg } = binding; if (arg === "el-table") { el = el.querySelector(".el-table__body-wrapper"); - setTimeout(() => { - el.classList.add("ps"); - el.classList.add("ps--active-y"); - el._ps_.update(); - }, 1500) !el && console.warn("未发现className为el-table__body-wrapper的dom"); + } else if (arg === "el-dropdown") { + el = el.querySelector(".el-dropdown-menu"); + !el && console.warn("未发现className为el-dropdown-menu的dom"); } + setTimeout(() => { + el.classList.add("ps"); + el.classList.add("ps--active-y"); + el._ps_.update(); + }, 1500) + try { vnode.context.$nextTick(() => { el_scrollBar(el);