当前位置: 首页 > news >正文

封装Progress 组件

因为业务需求所以有的地方没有放开,如有需要自行修改

<template><wbx-view ref="styleObj"><wbx-view style="position: relative;display: flex;flex-direction: row; align-items: center;" :style="{ width: videoProgressWidth + 'px',height:progressHeight+'px'}" @touchmove="handleTouchMove"@touchend~stop="handleTouch"><wbx-view style="position: absolute;transition: all 0.3s linear;" :style="{ height: progressHeight + 'px',borderRadius:radiusNum+'px'}"><wbx-view :style="{width: videoProgressWidth + 'px',height:progressHeight+'px',backgroundColor:progressBackgroundColor}" style="transition: all 0.3s linear;"></wbx-view><wbx-view :style="{ width: ProgressWidth,height:progressHeight+'px',backgroundColor:progressColor }" style="position: absolute;top: 0;"></wbx-view></wbx-view></wbx-view></wbx-view>
</template><script>
/*** 用法* * @type WBXAppOption*/
const pageOptions = {data() {return {boxProgressWidth:0,//整体进度条的宽度boxHeight:0,//整体进度条的高度progressHeight: 5, //进度条移动高度ProgressWidth: 0, //进度条移动的宽度marginLeftNum: 0, //距离左边距离percent: 0, //进度条移动的距离};},props: {videoProgressWidth: {type: Number,default: 300,},progressBackgroundColor:{type:String,default:'#e6e6e6'},progressColor:{type:String,default:'#bfbfbf'},ProgressWidth:{type: Number,default: 0,},progressHeight:{type: Number,default: 5,},radiusNum:{type: Number,default: 0,}},wbox: {onLoad() { },onShow() {// 页面显示/切入前台时触发},onHide() {// console.log(this.$refs.types,9999)// 页面隐藏时触发},onUnload() {// 页面退出时触发},},created() {// this.marginLeftNum =//   (wbx.getSystemInfoSync().windowWidth - this.videoProgressWidth) / 2;},mounted() { // this.progressStyleObject = this.$refs.styleObj.styleObject;// console.log(this.progressStyleObject ,"this.$refs.styleObj333",this.$refs.styleObj)// this.boxHeight=parseFloat(this.progressStyleObject.height)?parseFloat(this.progressStyleObject.height):10// this.videoProgressWidth=parseFloat(this.progressStyleObject.width)?parseFloat(this.progressStyleObject.width):300// console.log(this.videoProgressWidth,9999999)// this.progressHeight=parseFloat(this.progressStyleObject.height)?parseFloat(this.progressStyleObject.height):5},methods: {// 格式化时间formatMilliseconds(milliseconds) {const seconds = Math.floor(milliseconds / 1000);const minutes = Math.floor(seconds / 60);const secs = seconds % 60;const minutesFormatted = String(minutes).padStart(2, "0");const secondsFormatted = String(secs).padStart(2, "0");return `${minutesFormatted}:${secondsFormatted}`;},a() {// this.progressHeight = 10;},// 点击事件handleTouch(e) {returnthis.strokeHeight = 2;this.progressHeight = parseFloat(this.progressStyleObject.height)/2;console.log(e,"wwwwwwwwwwwwww")let minx = e.touches[0].clientX - this.marginLeftNum;if (minx > this.videoProgressWidth) {this.percent = this.videoProgressWidth;} else if (minx <= 0) {this.percent = 0;} else {this.percent = minx;}this.ProgressWidth = this.percent;this.$emit('moveDistance',this.ProgressWidth+this.marginLeftNum)// this.percent = parseInt((minx / this.videoProgressWidth) * 100);// this.seekTo = (this.percent / 100) * parseInt(this.duration);},// 滑动事件handleTouchMove(e) {returnthis.strokeHeight = 5;this.progressHeight = parseFloat(this.progressStyleObject.height);let minx = e.touches[0].clientX-this.marginLeftNum;if (minx > this.videoProgressWidth) {this.percent = this.videoProgressWidth;} else if (minx <= 0) {this.percent = 0;} else {this.percent = minx;}this.ProgressWidth = this.percent;this.$emit('moveDistance',this.ProgressWidth+this.marginLeftNum)// this.percent = (minx / this.videoProgressWidth) * 100;// this.seekTo = (minx/ this.videoProgressWidth)* this.duration;// this.seekTo = parseInt((minx/ this.videoProgressWidth)* this.duration/1000)*1000;},},computed: {// columnWidth() {//   return (this.containerWidth - (this.columnCount - 1) * this.columnGap) / this.columnCount// }},watch: {// items: {//   handler() {//     this.$nextTick(this.updateLayout)//   },//   deep: true// }},beforeDestroy() { },};
export default pageOptions;
</script>
<style></style>

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 排序算法的分析和应用
  • Redis作为单线程模型,为什么效率高、速度快呢?
  • 虚幻引擎解决构建问题
  • Chainlit集成LlamaIndex实现知识库高级检索(BM25全文检索器)
  • 图像压缩编码(4)--H.26x系列视频压缩编码_2
  • M9410A VXT PXI 矢量收发信机,300/600/1200MHz带宽
  • DPDK 简易应用开发之路 3:实现ping(ARP ICMP 协议)
  • vscode缩进 和自动格式化
  • MySQL表的内外连接
  • sqlserver创建表删除表
  • 库仑定律-库仑力-两个电荷之间静电力的计算公式
  • 计算机网络原理第二章
  • 全栈开发(二):springBoot3连接mysql数据库
  • PHP基础语法讲解
  • R包安装教程,如何安装rjags和infercnv
  • 【前端学习】-粗谈选择器
  • android高仿小视频、应用锁、3种存储库、QQ小红点动画、仿支付宝图表等源码...
  • C++类中的特殊成员函数
  • CentOS7简单部署NFS
  • Druid 在有赞的实践
  • fetch 从初识到应用
  • HTTP请求重发
  • JavaScript新鲜事·第5期
  • Java多线程(4):使用线程池执行定时任务
  • JS字符串转数字方法总结
  • laravel5.5 视图共享数据
  • spark本地环境的搭建到运行第一个spark程序
  • webpack项目中使用grunt监听文件变动自动打包编译
  • 干货 | 以太坊Mist负责人教你建立无服务器应用
  • 前端面试总结(at, md)
  • 在Unity中实现一个简单的消息管理器
  • ​二进制运算符:(与运算)、|(或运算)、~(取反运算)、^(异或运算)、位移运算符​
  • ‌U盘闪一下就没了?‌如何有效恢复数据
  • # include “ “ 和 # include < >两者的区别
  • (55)MOS管专题--->(10)MOS管的封装
  • (LNMP) How To Install Linux, nginx, MySQL, PHP
  • (创新)基于VMD-CNN-BiLSTM的电力负荷预测—代码+数据
  • (二)原生js案例之数码时钟计时
  • (免费领源码)Java#Springboot#mysql农产品销售管理系统47627-计算机毕业设计项目选题推荐
  • (七)Appdesigner-初步入门及常用组件的使用方法说明
  • (一)Mocha源码阅读: 项目结构及命令行启动
  • (原创)Stanford Machine Learning (by Andrew NG) --- (week 9) Anomaly DetectionRecommender Systems...
  • (原創) 系統分析和系統設計有什麼差別? (OO)
  • (转)可以带来幸福的一本书
  • (轉貼) 寄發紅帖基本原則(教育部禮儀司頒布) (雜項)
  • .gitattributes 文件
  • .Net 8.0 新的变化
  • .NET Core 控制台程序读 appsettings.json 、注依赖、配日志、设 IOptions
  • .Net Core 中间件与过滤器
  • .NET NPOI导出Excel详解
  • .NET 中让 Task 支持带超时的异步等待
  • .Net下C#针对Excel开发控件汇总(ClosedXML,EPPlus,NPOI)
  • @select 怎么写存储过程_你知道select语句和update语句分别是怎么执行的吗?
  • @TableId注解详细介绍 mybaits 实体类主键注解
  • [Android 13]Input系列--获取触摸窗口