当前位置:网站首页>Dynamic implementation of wechat applet 27 progress bar and static construction of search box and hot search list
Dynamic implementation of wechat applet 27 progress bar and static construction of search box and hot search list
2022-07-25 19:14:00 【Mu Quanyu [dark cat]】
27.1 Dynamic implementation of progress bar


// The progress of the music manager's real-time playback
appInstance.globalData.backgroundAudioManager.onTimeUpdate(() => {
let currentTime = moment(appInstance.globalData.backgroundAudioManager.currentTime * 1000).format('mm:ss');
if(this.data.isPlay && this.data.song.id == this.data.preMusicId){
this.setData({
currentTime
});
}
// Time now / Total time = The current progress bar width / Total progress bar width
// The current progress bar width = Time now / Total time * Total progress bar width
this.setData({
currentWidth:appInstance.globalData.backgroundAudioManager.currentTime * 1000/ this.data.durationSS * 450
})
});
// The natural end of music
appInstance.globalData.backgroundAudioManager.onEnded(() => {
PubSub.publish("switchType","next");// send out next request
this.setData({
// Restore progress bar's length
currentWidth: 0,
currentTime: '00:00'
})
})
After the music naturally ends , The next song should be played , And this operation Actually Just send a publish You can do it .
27.2 Search box 、 Static construction of hot search list
{
"usingComponents": {
},
"navigationBarTitleText": " Search for music "
}
<view class="searchContainer">
<!-- Head -->
<view class="header">
<view class="searchInput">
<text class="iconfont icon-search searchIcon"></text>
<input type="text" placeholder=" Search the song " placeholder-class="placeholder"></input>
</view>
<text class="cancel"> Cancel </text>
</view>
<!-- Hot search list -->
<view class="hotContainer">
<view class="title"> Hot search list </view>
<!-- Hot search list -->
<view class="hotList">
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
<view class="hotItem">
<text class="order">1</text>
<text> A preference for </text>
</view>
</view>
</view>
</view>
/* pages/search/search.wxss */
.searchContainer {
padding: 0 20rpx;
}
.header {
display: flex;
height: 60rpx;
line-height: 60rpx;
padding: 10rpx 0;
}
.searchInput {
position: relative;
flex: 1;
background: rgba(237,237,237,0.3);
border-right: 30rpx;
}
.cancel {
width: 100rpx;
text-align: center;
}
.searchIcon {
position: absolute;
left: 15rpx;
}
.searchInput input{
margin-left: 50rpx;
height: 60rpx;
}
/*h5 One of the new features , Can be placeholder Set up class and style */
.placeholder {
color: #d43c33;
font-size: 28rpx;
}
/* Hot search list */
.hotContainer .title {
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
border-bottom: 1rpx solid #eee;
}
.hotList {
display: flex;
flex-wrap: wrap;
}
.hotItem {
width: 50%;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
}
.hotItem .order {
margin: 0 10rpx;
}

边栏推荐
- SQL realizes 10 common functions of Excel, with original interview questions attached
- 鸿蒙-大喵计算画板-视频
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(8)毕业设计论文模板
- 【Web技术】1391- 页面可视化搭建工具前生今世
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(1)开发概要
- srec_cat 常用参数的使用
- Wechat campus maintenance application applet graduation design finished product of applet completion work (3) background function
- 有孚网络受邀参加2022全国CIO大会并荣获“CIO信赖品牌”称号
- Is Cinda securities a state-owned enterprise? Is it safe to open an account in Cinda securities?
- [Detr for 3D object detection] detr3d: 3D object detection from multi view images via 3D-to-2D queries
猜你喜欢

Fruit chain "siege": it's a journey of sweetness and bitterness next to apples

鸿蒙-大喵计算画板-简介

小程序毕设作品之微信校园维修报修小程序毕业设计成品(6)开题答辩PPT

21 days proficient in typescript-4 - type inference and semantic check
![[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!](/img/6d/b037208996ce52016d014062deaa1f.jpg)
[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!

JS basic type reference type deep / shallow clone copy

How to change the chords after the tune of the song is changed

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)

基于Mysql-Exporter监控Mysql

How to ensure the consistency of double write between database and cache?
随机推荐
Full scale and Xuan of C key
微信小程序 29 热搜榜的完善②
Virtual machine VMware installation steps (how to install software in virtual machine)
Weak network test tool -qnet
怎样设计产品帮助中心?以下几点不可忽视
房企打响“保交战”
【iniparser】项目配置工具iniparser的简单使用
GDB help
Cross Site Request Forgery in PHP
小程序毕设作品之微信校园维修报修小程序毕业设计成品(5)任务书
阿里云免费SSL证书申请详细流程
小程序毕设作品之微信校园维修报修小程序毕业设计成品(1)开发概要
[Detr for 3D object detection] detr3d: 3D object detection from multi view images via 3D-to-2D queries
Is Cinda securities a state-owned enterprise? Is it safe to open an account in Cinda securities?
QIIME2得到PICRUSt2结果后如何分析
无惧高温暴雨,有孚网络如何保您无忧?
How to change the chords after the tune of the song is changed
常用的开发软件下载地址
What is the application value of MES management system
有孚网络受邀参加2022全国CIO大会并荣获“CIO信赖品牌”称号