小程序 scroll-view 开启下拉刷新,上拉加载

<scroll-view 
    scroll-y // 纵向滚动
    style="height:" //高度
    refresher-enabled // 开启自定义下拉刷新
    refresher-background="" // 自定义下拉刷新背景颜色
    refresher-triggered="{{}}" // 下拉刷新触发状态 true为 触发 false为 没触发
    bindrefresherrefresh="" // 下拉触发事件
    bindscrolltolower=""> // 上拉触底引发事件
</scroll-view>

2.音频对象

// sub_Customer/pages/down_project/down_project.js
const innerAudioContext = wx.createInnerAudioContext()
Page({
   /**
    * 页面的初始数据
    */
   data: {

      srsss: '',
      names: '',
      showTime1: '00:00',
      showTime2: '00:00',

      audioDuration: 0,     //音频的总时间
      playSrc: '../../images/bo.png',          //播放,暂停图标路径
      isPlayAudio: false,   //播放状态
      audioSeek: 0,         //此刻所在的时间
      audioTime: 0,         //进度条百分比
      durationIntval: 0
   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {},

   bindFileDown(e) {
         that.setData({
            srsss: item.AttachmentURL,
            names: item.AttachmentName
         })

         innerAudioContext.src = item.AttachmentURL;
         //innerAudioContext.onEnded(() => {
            //console.log("播放结束");
            //that.setData({
               //isPlayAudio: false
            //})
         //})
         //innerAudioContext.onCanplay(() => {
            //console.log(innerAudioContext.paused);
         //})
         innerAudioContext.onTimeUpdate(() => {
            console.log("volumn:", innerAudioContext.volume);
            that.setData({
               showTime1: that.formatTime(innerAudioContext.currentTime),
               showTime2: that.formatTime(innerAudioContext.duration),
               audioTime: Math.floor(100 * innerAudioContext.currentTime / 
                          innerAudioContext.duration)
            })
         })
   },

   bindProjectClose() { //关闭
      innerAudioContext.stop();
      this.setData({
         playSrc: '../../images/bo.png',
         audioTime: 0,
         showTime1: '00:00',
         showProjectPop: false,
      })
   },

   sliderChange(e) {
      let position = Math.floor(innerAudioContext.duration * e.detail.value / 100);
      innerAudioContext.seek(position);
   },

   click() {
      this.setData({
         isPlayAudio: !this.data.isPlayAudio,

      })
      if (this.data.isPlayAudio) {
         innerAudioContext.play();
         this.setData({
            playSrc: '../../images/zan.png',

         })
      } else {
         innerAudioContext.pause();
         this.setData({
            playSrc: '../../images/bo.png',

         })
      }
   },

   formatTime(time) {
      let minute = Math.floor(time / 60);
      let second = Math.floor(time % 60);
      minute = minute < 10 ? ("0" + minute) : minute;
      second = second < 10 ? ("0" + second) : second;
      let res = minute + ":" + second;
      return res;
   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload: function () {
      innerAudioContext.stop();
   },


})

4.获取组件属性(高度,宽度)

    let query = wx.createSelectorQuery()
    let clas = "#" + 'mines';
    query.select(clas).boundingClientRect()
    query.exec(res => {
      console.log(res);
    })

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值