首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ionic中包含内容的工具栏

在ionic中包含内容的工具栏
EN

Stack Overflow用户
提问于 2018-04-09 20:57:17
回答 1查看 469关注 0票数 0

我在页面上有一个工具栏。单击工具栏中的项目,我将在同一页上显示内容。Ionics中的工具栏如何显示内容?

代码语言:javascript
复制
<ion-toolbar no-border-top>
<ion-segment>
  <ion-segment-button value="input">
    title1
  </ion-segment-button>
  <ion-segment-button value="output">
    title2
  </ion-segment-button>
  <ion-segment-button value="internal">
     title3
  </ion-segment-button>
  <ion-segment-button value="external">
    title4
  </ion-segment-button>
</ion-segment>

EN

回答 1

Stack Overflow用户

发布于 2018-04-09 22:26:29

可以使用离子段按钮的单击事件,如下所示

代码语言:javascript
复制
<ion-toolbar no-border-top>
<ion-segment>
  <ion-segment-button value="input" (click)="alterContent()">
    title1
  </ion-segment-button>
  <ion-segment-button value="output">
    title2
  </ion-segment-button>
  <ion-segment-button value="internal">
    title3
  </ion-segment-button>
  <ion-segment-button value="external">
    title4
  </ion-segment-button>
</ion-segment>

在ts文件中

代码语言:javascript
复制
alterContent(){
  this.content = "anotherContent";
}

内容显示在页面的内容区域中,如下所示

代码语言:javascript
复制
<ion-content>
  {{content}}
</ion-content>

但是,当您想要更改页面的完整内容时,有一些选项卡可以将其存档。详情请参见Ionic Docs

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49733548

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档