作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个页面,其中有两个不同的路由器(url)。我想根据url改变高度?是否可以?我怎样才能做到这一点?
例如,如果我在根路由器上,我希望页脚的高度为 100 像素,如果我在其他网址上,我希望高度为 64 像素?
我的代码看起来像这样
<view-router update-document-title testing>
<ehr-welcome-page-view pattern="/"></ehr-welcome-page-view>
<ehr-router-otherpattern="/other/*"></ehr-router-emis>
</view-router>
<footer>
<div class="footer-content-wrapper center-content border-right">
<a href="http://www.mypage.co.uk/" target="_blank">
<img src="./images/my-logotype.png" alt="MyLogotype">
</a>
</div>
<p>Some text</p>
</div>
</footer>
最佳答案
您可以使用函数根据路由参数(例如 url)返回类。
<app-route route="{{route}}" />
<div class$="footer-content-wrapper [[_getFooterHeightClass(route.path)]]">
_getFooterHeightClass(path) {
switch(path) {
case '/path/a':
return 'height-a';
case '/path/b':
return 'height-b';
}
}
关于javascript - 页脚高度根据网址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51189315/
我是一名优秀的程序员,十分优秀!