Skip to content

Commit

Permalink
fix: v-access指令无法控制元素展示隐藏 (#252)
Browse files Browse the repository at this point in the history
Co-authored-by: cwsong4 <[email protected]>
  • Loading branch information
scw919 and cwsong4 authored Oct 12, 2024
1 parent df36be4 commit 11c392d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/fes-plugin-access/src/runtime/createDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => {
Expand Down

0 comments on commit 11c392d

Please sign in to comment.