From ef13a4dba5e3ad27531d5be7b8bbac4163572060 Mon Sep 17 00:00:00 2001 From: Rookie Date: Sat, 12 Oct 2024 10:20:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20v-access=E6=8C=87=E4=BB=A4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=8E=A7=E5=88=B6=E5=85=83=E7=B4=A0=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=20(#252)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: cwsong4 --- packages/fes-plugin-access/src/runtime/createDirective.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/fes-plugin-access/src/runtime/createDirective.js b/packages/fes-plugin-access/src/runtime/createDirective.js index 3af1fdf6..85b323c7 100644 --- a/packages/fes-plugin-access/src/runtime/createDirective.js +++ b/packages/fes-plugin-access/src/runtime/createDirective.js @@ -13,7 +13,10 @@ export default function createDirective(useAccess) { beforeMount(el) { const ctx = {}; ctx.watch = (path) => { - el._display = el._display || el.style.display; + // el._display = el._display || el.style.display; // 这种只能获取到行内样式 会导致保存不了组件加载时的初始display + if (!el._display) { + el._display = window.getComputedStyle(el).display + } const access = useAccess(path); setDisplay(el, access); return watch(access, () => {