微信小程序 覆盖组件cover-view

wxml

覆盖组件

<video src="../image/1.mp4" controls="{{false}}" event-model="bubble">

<cover-view class="controls">

<cover-view class="play" bind:tap="play">

<cover-image class="img" src="../image/2.jpg" />

</cover-view>

<cover-view class="pause" bind:tap="pause">

<cover-image class="img" src="../image/1.jpg" />

</cover-view>

<cover-view class="time">00:00

</cover-view>

</cover-view>

</video>

复制代码
Page({
  data: {
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    interval: 2000,
    duration: 500,
    imgurls: ["../image/2.jpg", "../image/1.jpg", "../image/3.jpg", "../image/4.jpg", "../image/5.jpg"]
  },
  onReady() {
    this.videoCtx = wx.createVideoContext('myvideo')
  },
  play(){
    this.videoCtx.play()
  },
  pause(){
    this.videoCtx.pause()
  },
html 复制代码
/* pages/test/test.wxss */
.controls {
  position: relative;
  top: 50px;
  height: 50px;
  margin-top: -25px;
  display: flex;
}

.play, .pause, .time {
  flex: 1;
  height: 100%;
}

.time {
  text-align:  center;
  background-color: rgb(0, 0, 5);
  color: white;
  line-height: 50px;
}

.img {
  width: 40px;
  height: 40px;
  margin: 5px auto;
}
相关推荐
icebreaker6 小时前
Weapp-vite:原生模式之外,多一种 Vue SFC 选择
前端·vue.js·微信小程序
icebreaker6 小时前
重走 Vue 长征路 Weapp-vite:编译链路与 Wevu 运行时原理拆解
前端·vue.js·微信小程序
大米饭消灭者3 天前
Taro是怎么实现一码多端的【底层原理】
微信小程序·taro
FliPPeDround4 天前
Vitest Environment UniApp:让 uni-app E2E 测试变得前所未有的简单
微信小程序·e2e·前端工程化
FliPPeDround4 天前
微信小程序自动化的 AI 新时代:wechat-devtools-mcp 智能方案
微信小程序·ai编程·mcp
吴声子夜歌4 天前
小程序——布局示例
小程序
码云数智-大飞4 天前
如何创建自己的小程序,码云数智与有赞平台对比
微信小程序
luffy54594 天前
微信小程序页面使用类似filter函数的wxs语法
微信小程序·小程序
Slow菜鸟4 天前
微信小程序开发(二)目录结构完全指南
微信小程序·小程序
攀登的牵牛花4 天前
给女朋友写了个轻断食小程序:去老丈人家也是先动筷了
前端·微信小程序