「小程序JAVA实战」小程序的基础组件(24)
转自:https://idig8.com/2018/08/12/xiaochengxu-chuji-24/
来说下 ,小程序的基础组件。源码:https://github.com/limingios/wxProgram.git 中的No.11
基础组件
- icon图标组件
- rich-text 富文本组件
- text 文本组件
- progress 进度条组件
icon图标组件
- 官方介绍
>https://developers.weixin.qq.com/miniprogram/dev/component/icon.html

- 演示用例
<!--icon.wxml-->
<view class="container">
<icon type='success' color='red' size='55'></icon>
<icon type='success_no_circle' size='55'></icon>
<icon type='info' size='55'></icon>
<icon type='warn' size='55'></icon>
<icon type='waiting' size='55'></icon>
<icon type='cancel' size='55'></icon>
<icon type='download' size='55'></icon>
<icon type='search' size='55'></icon>
<icon type='clear' size='55'></icon>
</view>

text组件
- 官方介绍
>https://developers.weixin.qq.com/miniprogram/dev/component/text.html

- 演示用例
text.html
<!--text.wxml-->
<view>
<text selectable='{{true}}'>欢迎关注:编程坑太多</text>
</view>
<view>
<text>欢迎关注:编程坑太多</text>
</view>
<view>
<text space='{{true}}' decode="true">个人博客: idig8.com</text>
</view>
<view>
<text space='{{false}}'>个人博客: idig8.com</text>
</view>
<view>
<text decode="true">个人博客:\t\nidig8.com</text>
</view>

rich-text 富文本
- 官方介绍
>https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html

- 演示用例
rich-text.html
<!--rich-text.wxml-->
<view>
<rich-text nodes="{{mycontentStr}}"> </rich-text>
<rich-text nodes="{{mycontentArray}}"> </rich-text>
</view>
rich-text.js
//rich-text.js
//获取应用实例
const app = getApp()
Page({
data:{
mycontentStr: '<img class="s_lg_img_gold_show" src="//www.baidu.com/img/bd_logo1.png" width="270" height="129" >',
mycontentArray:[
{
name:"img",
attrs:{
class:"s_lg_img_gold_show",
src:"//www.baidu.com/img/bd_logo1.png",
width:"270",
height:"129"
}
}
]
}
})
rich-text.wxss
/**icon.wxss**/
.s_lg_img_gold_show{
width:600rpx;
}

使用富文本需要特别注意

progress 进度条
- 官方介绍
>https://developers.weixin.qq.com/miniprogram/dev/component/progress.html

- 演示用例
rich-text.html
<!--progress.wxml-->
<view>
<progress percent="70" show-info="{{true}}" stroke-width="20" color="red" active="{{true}}"></progress>
<progress percent="{{mypercent}}" show-info="{{true}}" stroke-width="20" color="red" active="{{true}}" active-mode='forwards'></progress>
<view bindtap='addpercent' >增加进度条百分比</view>
</view>
//progress.js
//获取应用实例
const app = getApp()
Page({
data:{
mypercent:15
},
addpercent:function(){
var newpercent = this.data.mypercent+20;
this.setData({
mypercent: newpercent
})
}
})

PS:关于基础组件部分就是这4块,从下次开始咱们一起了解下表单组件
「小程序JAVA实战」小程序的基础组件(24)的更多相关文章
- 「小程序JAVA实战」小程序的表单组件(25)
转自:https://idig8.com/2018/08/18/xiaochengxujavashizhanxiaochengxudebiaodanzujian25/ 来说下 ,小程序的基础组件.源码 ...
- 「小程序JAVA实战」小程序的组件(23)
转自:https://idig8.com/2018/08/11/xiaochengxu-chuji-23/ 开始了解下小程序的组件.源码:https://github.com/limingios/wx ...
- 「小程序JAVA实战」小程序的flex布局(22)
转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-22/ 之前已经把小程序的框架说完了,接下来说说小程序的组件,在说组件之前,先说说布局吧.源码:ht ...
- 「小程序JAVA实战」小程序的留言和评价功能(70)
转自:https://idig8.com/2018/10/28/xiaochengxujavashizhanxiaochengxudeliuyanhepingjiagongneng69/ 目前小程序这 ...
- 「小程序JAVA实战」小程序的举报功能开发(68)
转自:https://idig8.com/2018/09/25/xiaochengxujavashizhanxiaochengxudeweixinapicaidancaozuo66-2/ 通过点击举报 ...
- 「小程序JAVA实战」小程序的个人信息作品,收藏,关注(66)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudegerenxinxizuopinshoucangguanzhu65 ...
- 「小程序JAVA实战」小程序的关注功能(65)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeguanzhugongneng64/ 在个人页面,根据发布者个人和 ...
- 「小程序JAVA实战」小程序的视频点赞功能开发(62)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeshipindianzangongnengkaifa61/ 视频点 ...
- 「小程序JAVA实战」小程序的springboot后台拦截器(61)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudespringboothoutailanjieqi60/ 之前咱们把 ...
随机推荐
- 【ACM非算法部分】综合篇
从零开始系列,也为了更好的补缺补漏. ===================== 目录: scanf()函数 STL汇总 读入优化 =====================
- 对集合应用符号 | & ^ -
s1 = set('abc') s2 = set('abs') # 在s1而不在s2 print s1 - s2 # set(['c']) # 在s1或者s2 print s1 | s2 # set( ...
- js中怎么去掉数组的空值
for(var i = 0 ;i<array.length;i++) { if(array[i] == "" || typeof(array[i] ...
- 接口测试框架——第二篇-python读取excel文件内容
今天完善excel_module.py文件,上代码: # coding: utf-8 import xlrd class ReadExcel(): def __init__(self, file_na ...
- windows常用的命令行操作
1.切换当前目录 cd 路径 --change directory 2.创建目录 mkdir ‘文件名’ --make directory touch '文件名' --创建文件(多个文件用,分隔) 3 ...
- 几种分布式调用技术的比较 -- RPC VS REST
我之前在传统IT公司干活,后来来了互联网,感受到了很多不同,其中有一点就是两者使用到的技术有一些差别.比如说分布式调用技术. 我在的这家公司内部的服务架构是基于Thrift的,服务基于Thrift进行 ...
- caddy server 了解
Caddy 是一个Go写的服务器软件,官方的宣传语“The HTTP/2 web server with automatic HTTPS”以及“Serve The Web Like It's 2016 ...
- 多文件的Makefile
Linux下编写一般采用gcc编译工具,但gcc无法满足大量的文件同时编译,这是就用到Makefile,首先先介绍一下gcc GCC编译的四个步骤 1.预处理,生成预编译文件(.文件): Gcc –E ...
- Java多线程编程核心技术,第一章
1,Java并发--详解this与Thread.currentThread()的区别:https://blog.csdn.net/championhengyi/article/details/7666 ...
- PHP设置脚本最大执行时间的三种方法
php.ini 中缺省的最长执行时间是 30 秒,这是由 php.ini 中的 max_execution_time 变量指定,如果脚本需要跑很长时间,例如要大量发送电子邮件,或者分析统计大量数据,服 ...