搜索栏没有在Ionic上显示

时间:2016-11-23 10:48:36

标签: java ionic-framework ionic2

我试图在我的屏幕顶部的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>

截图:

Screenshot

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

我尝试将其置于我的视图中的其他组件之间,但它也不会出现。文档不解释有关此主题的任何内容。非常令人沮丧

1 个答案:

答案 0 :(得分:0)

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

这是您提供的代码,如果您删除了plunker中的所有<br/>标记,您会看到搜索栏被推到标题后面。

enter image description here

因此,向style="z-index:999999999999"添加<ion-searchbar>(只是为了确定)会产生这个问题:

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

enter image description here

相关问题