【问题标题】:How to build a fixed footer in NativeScript-Vue?如何在 NativeScript-Vue 中构建固定页脚?
【发布时间】:2019-03-15 21:16:03
【问题描述】:

我想在页面中有一个固定的页脚,但我尝试使用

<StackLayout>

还有一个

position: absolute;
bottom: 0;

在容器父级

position: relative

但什么也没发生。

我试过了

<AbsoluteLayout bottom="0">

然后什么也没发生。

有人知道怎么做吗?谢谢!

【问题讨论】:

    标签: nativescript nativescript-vue


    【解决方案1】:

    &lt;AbsoluteLayout&gt; 将元素绝对放入其中。使用 NativeScript,我们必须使用 Layout Containers 在其中放置元素。

    实现您想要的最佳布局:

    1) &lt;DockLayout&gt;,例如

    <DockLayout>
      <Label dock="bottom" height="60" backgroundColor="yellow" text="footer"/>
      <Label text="rest of the content"/>
    </DockLayout>
    

    2) &lt;GridLayout&gt;,例如

    <GridLayout columns="*, 60">
      <Label col="0" text="rest of the content"/>
      <Label col="1" text="footer"/>
    </GridLayout>
    

    请学习layout containers documentation

    【讨论】:

    • 好的,谢谢!另一个问题是我想在页脚内插入一个带有三个锚链接的文本,我该怎么做?例如,我有:&lt;DockLayout&gt; &lt;Label dock="bottom" class="footer" text="footer" /&gt; &lt;/DockLayout&gt; 但我想添加一个文本,其中包含一个锚链接:我该怎么做?
    • 您确实需要深入研究文档,@P1_10。或者查看一些类似这样的演示应用程序:github.com/tralves/groceries-ns-vue。在本机应用程序中,我们避免使用“锚链接”,而是使用&lt;Button&gt;s。在你的情况下,我会嵌套一个&lt;GridLayout&gt;。比如:&lt;DockLayout&gt; &lt;GridLayout dock="bottom" class="footer" columns="*,*,*" &gt; &lt;Button text="button 1" col="0"/&gt; &lt;Button text="button 2" col="1"/&gt; &lt;Button text="button 3" col="2"/&gt; &lt;/GridLayout&gt; &lt;/DockLayout&gt;
    猜你喜欢
    • 2021-08-13
    • 1970-01-01
    • 2019-08-07
    • 2015-10-20
    • 2019-12-30
    • 2020-05-13
    • 2023-03-10
    • 2016-06-19
    • 2018-05-26
    相关资源
    最近更新 更多