小程序六:组件之基础内容

本文档详细介绍了图标和进度条两种UI组件的使用方法,包括各组件的属性配置及其实现的效果展示。通过示例代码,开发者可以快速了解如何在项目中应用这些组件。
icon

图标。
属性名 类型 默认值 说明
type String   icon的类型,有效值:success, success_no_circle, info, warn, waiting, cancel, download, search, clear
size Number 23 icon的大小,单位px
color Color   icon的颜色,同css的color

text

文本节点,支持转义符"\"。
除了文本节点以外的其他节点都无法长按选中
示例:
<view class="section section_gap">
    <text>{{text}}</text>
    <view class="btn-area">
        <button bindtap="add">add line</button>
        <button bindtap="remove">remove line</button>
    </view>
</view>
var initData = 'this is first line\nthis is second line'
Page({
  data: {
    text: initData
  },
  extraLine: [],
  add: function(e) {
    this.extraLine.push('other line')
    this.setData({
      text: initData + '\n' + this.extraLine.join('\n')
    })
  },
  remove: function(e) {
    if (this.extraLine.length > 0) {
      this.extraLine.pop()
      this.setData({
        text: initData + '\n' + this.extraLine.join('\n')
      })
    }
  }
})
progress

进度条
属性名 类型 默认值 说明
percent Float 百分比0~100
showInfo Boolean false 在进度条右侧显示百分比
strokeWidth Number 6 进度条线的宽度,单位px
color Color #09BB07 进度条颜色
active Boolean false 进度条从左往右的动画
示例:
<progress percent="20" show-info />
<progress percent="40" stroke-width="12" />
<progress percent="60" color="pink" />
<progress percent="80" active />


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值