未隐藏子元素时如何设置组件宿主的样式?

时间:2019-07-17 13:36:53

标签: angular sass

我有一个图像预览组件,并且我想在未隐藏预览的情况下阻止应用程序组件滚动。是否有仅scss / css的方法可以做到这一点?

我发现,如果使用Set mainWin = .Window 伪类将 mainWin.Activate MsgBox "Click OK After Entering Captcha", 64 的{​​{1}}属性设置为app-component,则可以阻止页面滚动。我尝试了以下代码:

overflow

但是什么也没发生。我尝试了另一个hidden,但没有任何改变。

预览组件在其父组件中看起来像这样。     

仅在隐藏页面时,页面才应滚动到预览后面。无论如何,它都在滚动。使用SCSS可以吗?

1 个答案:

答案 0 :(得分:0)

您可以使用属性和类属性对其进行管理。

app.component.html

<div [class.opened]="open"> //wrapper for app component
...
</div>

CSS

.opened{
   height: 500px; // set it again 
   overflow: hidden;
}

demo

相关问题