我是靠谱客的博主 无辜面包,这篇文章主要介绍uniapp 进度条,现在分享给大家,希望可以做个参考。

uniapp使用:style写一个简单进度条


)

进度条的样式图

  1. html代码 v-bind:style 简写形式:style
<!--  第一层进度条的背景色  -->
 <view class="strip"> 
		 <!-- 第二层进度条的颜色 -->
		<view class="blue" :style="'width:'+info.progress+'%'"> 
			<!-- (进度条显示的图片  样式:根据父元素进行相对定位 ,本身绝对定位 ) -->
			<image src="../../static/list/niu.png" class="proImg" :style="'left:'+info.progress-1+'%'"> </image>
		</view>
 </view>

2.css代码

.strip {
		/* 父元素相对定位 */
		position: relative;
		width: 360rpx;
		height: 12rpx;
		color: rgba(80, 80, 80, 1);
		background-color: #F5F5F5;
		border-radius: 7rpx;
		font-size: 28rpx;
		line-height: 150%;
		text-align: center;
	}
	.blue {
		height: 12rpx;
		color: rgba(80, 80, 80, 1);
		background-color: #1676FE;
		border-radius: 7rpx;
		font-size: 28rpx;
		line-height: 150%;
		text-align: center;
	}
	.proImg{
		width:84rpx;
		height:76rpx;
		/* 子元素绝对定位   */
		position: absolute;
		/* 定位方向:属性值 */
		top:-30rpx
 	}

3.data(数据)

export default{
	data(){
			return{
					info:{
							progress:32,	
							}
					 }
			}
 }

这样一个简单的进度条就完成了(* ̄︶ ̄)

最后

以上就是无辜面包最近收集整理的关于uniapp 进度条的全部内容,更多相关uniapp内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(126)

评论列表共有 0 条评论

立即
投稿
返回
顶部