fix: v-access指令无法控制元素展示隐藏 (#252)

Co-authored-by: cwsong4 <cwsong4@iflytek.com>
This commit is contained in:
Rookie 2024-10-12 10:20:41 +08:00 committed by GitHub
parent df36be4671
commit 11c392d3d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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, () => {