【问题标题】:How to get Ionic toggle on the left hand side of the label?如何在标签左侧获得离子切换?
【发布时间】:2017-11-10 03:43:10
【问题描述】:

我在 ion-item 中有一个简单的切换和标签:

<ion-item>
    <ion-toggle checked="true"></ion-toggle>
    <ion-label>Aangemeld blijven</ion-label>
</ion-item>

我想将切换开关放在标签的左侧,但我的结果是:

我试过左右浮动,但没有用。

你有什么建议吗?

【问题讨论】:

    标签: css ionic-framework


    【解决方案1】:

    我认为你应该使用 item-start 属性,它适用于我,它可能是最推荐的。

    <ion-item>
        <ion-toggle item-start checked="true"></ion-toggle>
        <ion-label>Aangemeld blijven</ion-label>
    </ion-item>
    

    【讨论】:

      【解决方案2】:

      使用这两个类覆盖并在右侧显示 ion-toogle 文本

      .item-toggle .toggle
      {
         left: 16px !important;
      }
      .item-toggle .ng-binding
      {
         margin-left: 98%  !important;
      }
      

      示例:https://codepen.io/codeandyou/pen/obvYOG

      【讨论】:

      • 您好,非常感谢您的回复!但据我所知,你做了一个 Ionic 1 的例子。你也有 Ionic 2/3 的例子吗?
      • 试试这个 ion-buttons { order: 1 }
      • 我将它添加到 login.scss 中,如下所示:page-login { ion-buttons { order: 1 } .... 但没有结果 :(
      猜你喜欢
      • 2019-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      • 1970-01-01
      • 2012-08-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多