我有一个页面,其中有两个不同的路由器(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/