nativescript - Nativescript Vue:如何更改帧高度以考虑其他内容的空间?
问题描述
我主要App.vue
有一个组件,称为BottomNavigationBar
它总是在屏幕上。除此之外,我有一个单独Frame
的加载CountryListComponent
,它导航到该组件的不同部分。唯一的问题是,一些单独加载的内容Frame
被隐藏在持久化的后面BottomNavigationBar
。我假设我必须调整新Frame
的高度以降低高度以解决BottomNavigationBar
. 我添加了一个@loaded
调用但不确定在其中运行什么来调整高度adjustFrameHeight
的事件。Frame
最好的方法是什么?
<template>
<Page actionBarHidden="true">
<DockLayout height="100%">
<Frame @loaded="adjustFrameHeight" id="main-frame" height="90%" v-show="this.selectedTab =='1'">
<CountryListComponent dock="top" @handleItemTap="handleItemTap" :movies="this.movies"/>
</Frame>
<BottomNavigationBar
dock="bottom"
activeColor="red"
inactiveColor="yellow"
backgroundColor="blue"
@tabSelected="this.changeTab"
verticalAlignment="bottom"
row="1">
<BottomNavigationTab title="First" icon="icon-29.png" />
<BottomNavigationTab title="Second" icon="icon-29.png" />
<BottomNavigationTab title="Third" icon="icon-29.png" />
</BottomNavigationBar>
</DockLayout>
</Page>
</template>
解决方案
您可以尝试使用 aGridLayout
而不是DockLayout
.
*
将占用屏幕上的可用空间,auto
并将占用该行中子组件的最大高度。
<template>
<Page actionBarHidden="true">
<GridLayout rows="*, auto" height="100%">
<Frame row="0" @loaded="adjustFrameHeight" id="main-frame" height="100%" v-show="this.selectedTab =='1'">
<CountryListComponent @handleItemTap="handleItemTap" :movies="this.movies"/>
</Frame>
<BottomNavigationBar
row="1"
activeColor="red"
inactiveColor="yellow"
backgroundColor="blue"
@tabSelected="this.changeTab"
verticalAlignment="bottom">
<BottomNavigationTab title="First" icon="icon-29.png" />
<BottomNavigationTab title="Second" icon="icon-29.png" />
<BottomNavigationTab title="Third" icon="icon-29.png" />
</BottomNavigationBar>
</GridLayout>
</Page>
</template>
推荐阅读
- c# - 循环 xml 并将值存储为变量 - C#
- google-chrome - 如何在 Google Chrome Apps 中监听网络请求/DOM 变化?
- c++ - 如何设置ceph dout级别?
- image - 网络爬虫在第一页停止
- ruby-on-rails - 使用 rake 任务部署后以及每当 gem 时未设置 Crontab
- windows - 无法在 VMware 中更改 Windows10 上的注册表值
- cassandra - 对 Yugobyte 的 Akka 持久性支持
- c++ - 如何在 C++ 中使用 detectnet trt 文件?
- python - Django 错误 - Pillow 未安装,即使已安装
- google-earth-engine - 如何在 Earth Engine 中查找和分类具有相同值的像素数?