课程表

ionic 准备

ionic CSS

ionic JavaScript

工具箱
速查手册

ionic 表单和输入框

当前位置:免费教程 » 移动开发 » ionic

list 类同样可以用于 input 元素。item-input 和 item 类指定了文本框及其标签。

输入框属性:placeholder

以下实例中,默认为100%宽度(左右两侧没有边框),并使用 placeholder 属性设置输入字段预期值的提示信息。

  1. <div>
  2. <label class="item item-input">
  3. <input type="text" placeholder="First Name">
  4. </label>
  5. <label class="item item-input">
  6. <input type="text" placeholder="Last Name">
  7. </label>
  8. <label class="item item-input">
  9. <textarea placeholder="Comments"></textarea>
  10. </label>
  11. </div>

尝试一下 »

输入框属性:input-label

使用 input-label 将标签放置于输入框 input 的左侧。

  1. <div>
  2. <label class="item item-input">
  3. <span class="input-label">用户名:</span>
  4. <input type="text">
  5. </label>
  6. <label class="item item-input">
  7. <span class="input-label">密码:</span>
  8. <input type="password">
  9. </label>
  10. </div>

尝试一下 »


堆叠标签

堆叠标签通常位于输入框的头部。每个选项使用 item-stacked-label 类指定。 每个输入框需要指定 input-label。以下实例也使用了 placeholder 属性来设置信息输入提示。

  1. <div>
  2. <label class="item item-input item-stacked-label">
  3. <span class="input-label">First Name</span>
  4. <input type="text" placeholder="John">
  5. </label>
  6. <label class="item item-input item-stacked-label">
  7. <span class="input-label">Last Name</span>
  8. <input type="text" placeholder="Suhr">
  9. </label>
  10. <label class="item item-input item-stacked-label">
  11. <span class="input-label">Email</span>
  12. <input type="text" placeholder="john@suhr.com">
  13. </label>
  14. </div>

尝试一下 »


浮动标签

浮动标签类似于堆叠标签,但浮动标签有一个动画的效果,每个选项需要指定 item-floating-label 类,输入标签需要指定 input-label。

  1. <div>
  2. <label class="item item-input item-floating-label">
  3. <span class="input-label">First Name</span>
  4. <input type="text" placeholder="First Name">
  5. </label>
  6. <label class="item item-input item-floating-label">
  7. <span class="input-label">Last Name</span>
  8. <input type="text" placeholder="Last Name">
  9. </label>
  10. <label class="item item-input item-floating-label">
  11. <span class="input-label">Email</span>
  12. <input type="text" placeholder="Email">
  13. </label>
  14. </div>

尝试一下 »


内嵌表单

默认情况下每个输入域宽度都是100%,但我们可以使用 list list-inset 或 card 类设置表单的内边距(padding), card 类带有阴影。

  1. <div class="list list-inset">
  2. <label class="item item-input">
  3. <input type="text" placeholder="First Name">
  4. </label>
  5. <label class="item item-input">
  6. <input type="text" placeholder="Last Name">
  7. </label>
  8. </div>

尝试一下 »


内嵌输入域

使用 list-inset 设置内嵌实体列表。 使用 item-input-inset 样式可以内嵌一个按钮。

  1. <div>
  2.  
  3. <div class="item item-input-inset">
  4. <label class="item-input-wrapper">
  5. <input type="text" placeholder="Email">
  6. </label>
  7. <button class="button button-small">
  8. Submit
  9. </button>
  10. </div>
  11.  
  12. </div>

尝试一下 »


带图标的输入框

item-input 输入框可以很简单的添加图标。 图标可以在 <input> 前添加。

  1. <div class="list list-inset">
  2. <label class="item item-input">
  3. <i class="icon ion-search placeholder-icon"></i>
  4. <input type="text" placeholder="Search">
  5. </label>
  6. </div>

尝试一下 »


头部输入框

输入框可放置在头部,并可添加提交或取消按钮。

  1. <div class="bar bar-header item-input-inset">
  2. <label class="item-input-wrapper">
  3. <i class="icon ion-ios-search placeholder-icon"></i>
  4. <input type="search" placeholder="搜索">
  5. </label>
  6. <button class="button button-clear">
  7. 取消
  8. </button>
  9. </div>

尝试一下 »

转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号