首页 > 课堂 > 小程序 > 正文

微信小程序开发之组件使用教程

2020-03-21 16:23:11
字体:
来源:转载
供稿:网友

微信小程序开发之组件使用教程。

icon

icon组件有3个属性,如下:

  • type,可选值:success, success_no_circle, info, info_circle,warn, waiting, cancel, download, search, clear
  • color,如#C9C9C9。
  • size,默认为23px。

先看一张效果图:

微信小程序,小程序开发,组件

再看具体的wxml和wxss。

<code class="language-wxml hljs fsharp has-numbering"><view class="demo-view-4">    <view class="view-1">        <icon class="margin" type="circle">        <view class="margin">circle:多选未选中</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="success">        <view class="margin">success:成功或已选中</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="success_no_circle">        <view class="margin">success_no_circle:单选已选中</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="info">        <view class="margin">info:信息提示</view>    </icon></view>    <view class="view-1">        <icon class="margin" color="#C9C9C9" type="warn">        <view class="margin">warn-#C9C9C9:普通警告</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="warn">        <view class="margin">warn:强烈警告</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="waiting">        <view class="margin">waiting:等待</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="download">        <view class="margin">download:可下载</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="info_circle">        <view class="margin">info_circle:有信息提示</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="cancel">        <view class="margin">cancel:停止或关闭</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="search">        <view class="margin">search:搜索</view>    </icon></view>    <view class="view-1">        <icon class="margin" type="clear">        <view class="margin">clear:删除</view>    </icon></view>    <view class="view-1">        <view class="margin">PS:每个type都可以设置颜色(color),大小(size)</view>    </view></view></code></pre><pre class="prettyprint" name="code"><code class="language-css hljs  has-numbering">.demo-view-4{    display:flex;    height: 100%;    flex-direction: column;}.view-1{    display:flex;    height: 100%;    flex-direction: row;}.margin{    margin: 20rpx;}</code>

text


效果图如下:

微信小程序,小程序开发,组件

wxml如下:

<code class="language-xml hljs  has-numbering"><text>My name is wisely。/n I am a Androider!</text></code>

progress

progress组件的属性如下:

属性名 类型 默认值 说明
percent Float 百分比0~100
show-info Boolean false 在进度条右侧显示百分比
stroke-width Number 6 进度条线的宽度,单位px
color Color #09BB07 进度条颜色 (请使用 activeColor)
activeColor Color   已选择的进度条的颜色
backgroundColor Color   未选择的进度条的颜色
active Boolean false 进度条从左往右的动画

效果图如下:

微信小程序,小程序开发,组件


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表