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

网站维护上海黔西南州建设银行网站

网站维护上海,黔西南州建设银行网站,龙岗区网站制作,产品推广建议文章目录 一、前言二、实现代码三、参考链接 一、前言 在华为快应用中官方提供了slider控件#xff0c;但是这个控件的限制比较多#xff0c;比如滑块无法自定义#xff0c;所以这里进行下自定义#xff0c;自己修改样式。 二、实现代码 整体效果如下: 源码如下… 文章目录 一、前言二、实现代码三、参考链接 一、前言 在华为快应用中官方提供了slider控件但是这个控件的限制比较多比如滑块无法自定义所以这里进行下自定义自己修改样式。 二、实现代码 整体效果如下: 源码如下: custom_slider.ux templatediv idcontainerdiv idprogress-background/divdiv idprogress-second stylewidth: {{progressSecondWidth}}px/divdiv idslider styleleft: {{left}}px ontouchmovehandleTouchMove/div/div /templatescriptimport prompt from system.promptexport default {props: [progress,min,max,step],public: {progressSecondWidth: 0,left: 0,right: 0,//右侧可以滑动到的位置containerLeft: 0,containerRight: 0,stepWidth: 1, // 每一步滑动的距离这个根据step值进行计算minDuration: 5, //滑动最小间距,小于这个间距不算滑动},onInit: function () {this.$on(onShow, this.onShow)this.$watch(progress, progressChange)},progressChange(newValue, oldValue) {console.log(progressChange: JSON.stringify(newValue))if(newValue oldValue){return}this.sliderOtherProgress(newValue)},handleTouchMove(e) {let touchX e.touches[0].clientX - this.containerLeft; // 获取触摸点的全局X坐标if (touchX - this.progressSecondWidth -this.minDuration) {this.leftSlide()}if (touchX - this.progressSecondWidth this.minDuration) {this.rightSlide()}this.emitChange()},onShow(e) {let that thisthis.$element(container).getBoundingClientRect({success: function (data) {const { top, bottom, left, right, width, height } data;prompt.showToast({message: getBoundingClientRect结果 width:${width}, height:${height},top:${top}, bottom:${bottom}, left:${left}, right:${right}})that.containerLeft leftthat.containerRight rightthat.right right - left - 40 //40是滑块的宽度that.computerStepWidth()},fail: (errorData, errorCode) {prompt.showToast({message: 错误原因${JSON.stringify(errorData)}, 错误代码${errorCode}})},complete: function () {console.info(complete)}})},//向左滑动leftSlide() {let nextWidth this.progressSecondWidth - this.stepWidthif (nextWidth 0) {nextWidth 0}this.progressSecondWidth nextWidththis.left nextWidth;},//向右滑动rightSlide() {let nextWidth this.progressSecondWidth this.stepWidthif (nextWidth this.right) {nextWidth this.right}this.progressSecondWidth nextWidththis.left nextWidth;},computerStepWidth() {let progressMax 100;let progressMin 0;let progressStep 1;let currentProgress 0;if (this.max) {progressMax this.max}if (this.min) {progressMin this.min}if (this.step) {progressStep this.step}if (this.progress) {currentProgress this.progress}this.stepWidth this.right / (progressMax - progressMin) * progressStep //获取每一步滑动的距离let currentProgressWidth this.stepWidth * currentProgressthis.progressSecondWidth currentProgressWidth},sliderOtherProgress(progress){let nextWidth progress this.stepWidthif (nextWidth this.right) {nextWidth this.right}if (nextWidth 0) {nextWidth 0}this.progressSecondWidth nextWidththis.left nextWidth;this.emitChange()},emitChange() {let progress Math.ceil(this.progressSecondWidth / this.stepWidth)this.$emit(change, {progress})}} /scriptstyle langless#container {flex-grow: 1;height: 24px;display: flex;}#progress-background {flex-grow: 1;height: 4px;background-color: red;margin-top: 10px;border-radius: 4px;}#progress-second {height: 4px;background-color: pink;margin-top: 10px;border-radius: 4px;left: 0px;position: absolute;}#slider {width: 40px;height: 24px;background-color: #3b2204;position: absolute;border-radius: 12px;} /style 使用如下: import namecustom-slider src./custom_slider/import ... custom-slider onchangeprogressChange progress{{customSliderProgress}}/custom-slider scriptimport prompt from system.promptexport default {public: {customSliderProgress: 30,},progressChange(evt){console.log(---当前进度,evt.detail.progress);},} /script ...三、参考链接 touch
http://www.zqtcl.cn/news/332491/

相关文章:

  • 唐山网站建设方案优化国内酷炫网站
  • 国外网站备案吗网站做一样没有侵权吧
  • 谷歌怎么建网站ps中怎样做网站轮播图片
  • 汕头有没有做网站廊坊宣传片制作公司
  • 百度快速收录网站有些人做网站不用钱的 对吗
  • 如何规划一个网站网站建设预付费入什么科目
  • 北京做网站的好公司有哪些网站建设杭州缘择低价
  • 建设网站团队张掖响应式建站平台
  • 中国建设之乡是哪里网站优化连云港哪家强?
  • 网站建设报价是多少30号长沙封城最新消息
  • 常州专业网站建设费用电商推广技巧
  • 辽源市网站建设南通营销网站开发
  • 新站优化案例去韩国用什么地图导航
  • 宁波网站制作与推广WordPress怎么文章分类
  • mvc 做网站国内的搜索引擎有哪些
  • 设计视频网站腾讯云服务器网站域名备案
  • 网站建设费算费用还是固定资产镇赉县做网站的
  • 山西 旅游 英文 网站建设wordpress 设置登陆界面
  • 电商网站系统建设考试深圳网站建设培训哪家好
  • 工作室 网站项目策划书八篇案例
  • ui做网站流程建设统计网站进不去
  • 沧州网站建设优化公司网站改版
  • 网站开发工程师好不好注册科技公司流程和费用
  • wordpress站点费用vs手表官网
  • 网站买卖需要注意什么景安怎么把网站做别名
  • 网站建设网站建怎么做一个门户网站
  • 站长工具域名备案查询安卓app开发教程视频免费
  • 赶集网网站建设分析河南郑州旅游网站设计
  • 怎么可以黑网站域名建设网站的网站是什么
  • 帝国网站数据库配置文件建筑人才网招聘网官网首页