【问题标题】:searchbar not showing on Ionic搜索栏未在 Ionic 上显示
【发布时间】:2016-11-23 19:32:45
【问题描述】:

我正在尝试在我的屏幕顶部在 android 的标签栏下方和 ios 的导航栏下方制作一个固定的搜索栏。

我正在使用文档:http://ionicframework.com/docs/v2/api/components/searchbar/Searchbar/

离子版本:2.1.12

但我的搜索栏没有显示。

我的代码:

HTML:

<ion-view title="Search" id="page3" hide-nav-bar="isAndroid">
    <div class="bar bar-subheader bar-positive item-input-inset" no-tap-scroll="true">
        <ion-searchbar
            [(ngModel)]="search"
            [showCancelButton]="shouldShowCancel"
            (ionInput)="handleSearch($event)">
        </ion-searchbar>
    </div>
    <ion-content has-header="true" padding="true">
        <ion-list>
            <ion-item ng-repeat="doc in documents" item="doc">
            </ion-item>
        </ion-list>
    </ion-content>
</ion-view>

截图:

如您所见,没有出现搜索栏...

我尝试将它放在视图中的其他组件之间,但它也没有出现。文档没有解释任何关于这个主题的内容。很郁闷

【问题讨论】:

    标签: java ionic-framework ionic2


    【解决方案1】:

    http://plnkr.co/edit/dPsGZjczRSNpqmMDqLZQ?p=info

    这是您提供的代码,如果您删除 plunker 中的所有 &lt;br/&gt; 标签,您将看到搜索栏被推到标题后面。

    所以在&lt;ion-searchbar&gt; 中添加style="z-index:999999999999"(只是为了确定)导致了这个plunker:

    http://plnkr.co/edit/JE1Vm47ehXsmkp5s9PGZ?p=info

    【讨论】:

    • 会不会这么简单我可能已经想通了,但事实并非如此......不幸的是
    • @HelderJulesDeBaere 然后请发布更多代码,这是您发布的代码的解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-29
    • 2022-01-24
    • 2018-05-06
    • 1970-01-01
    • 1970-01-01
    • 2016-05-04
    相关资源
    最近更新 更多