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

uniapp刻度尺的实现(swiper)滑动打分器

实现图(百分制):滑动swiper进行打分,分数加减

在这里插入图片描述

<view class="scoring"><view class="toggle"><view class="score"><text>{{'0'}}</text><view class="scoreId" ><block v-if="transFlag&&scoreFlag">{{testScore}}</block><block v-else>{{currentScore}}</block></view><text>{{'100'}}</text></view><view><view class="line-con"><text class="line"></text></view><swiper class="swipers" display-multiple-items="17" duration="400"  easing-function="easeInOutCubic" @transition="transScore" @change="changeScore"  :current="currentSwiper" ><swiper-item class="swiperItems" v-for="(item,index) in 117" key="index"><view class="lines"></view></swiper-item></swiper></view></view>
</view>
/* 分数波动过程中显示实时分数*/ /*滑动过快会有问题*/
transScore(e){this.transFlag = trueif(this.transFlag&&this.scoreFlag){this.testScore = this.currentScore +  Math.floor(e.detail.dx/21) <= 0? 0 :this.currentScore +  Math.floor(e.detail.dx/20)}else{this.testScore = this.currentScore}
},
/*打分动作回调-停下*/
changeScore(e){this.currentScore = this.currentSwiper===null||this.currentSwiper===''?this.currentSwiper:e.detail.current;this.testScore = this.currentScorethis.currentSwiper = e.detail.current;this.transFlag = false;this.scoreFlag = false;setTimeout(()=>{this.scoreFlag = true},600)
},
.toggle{background-image: url(/static/image/toggle.png);background-size: cover;padding: 4px 4px 16px 4px;border-radius: 8px;box-shadow: 2px 6px 8px 0 #00622D17;margin-top: 16px;border-right: 1px solid #fbfcfdc2;
}
.score{display: flex;justify-content: space-between;color: #BDBDBD;font-size: 24rpx;align-items: flex-end;font-weight: bold;position: relative;height: 70rpx;margin-top: 22rpx;padding: 0 10px;.scoreId{color: #20A13E;font-size:64rpx ;position: absolute;text-align: center;width: 100%;bottom: 0px;left: 0;}
}
.swipers{height: 100%;width: 100%;margin: 0 auto;overflow: visible;height: 100rpx;
}
.swiperItems{font-size:24rpx;position:relative;margin-top: 32rpx;height: 56rpx !important;overflow: visible;display: flex;align-items: center;justify-content: center;
}
.swiperItems > .lines{background-color:#BDBDBD;width:1px;height:58rpx !important;
}
.line-con{width: 100%;position: relative;display: flex;justify-content: center;align-items: center;.line{position: absolute;width: 6rpx;height: 40px;top: 20rpx;background: #20a13e;z-index: 6;}
}
http://www.lryc.cn/news/223798.html

相关文章:

  • cordova Xcode打包ios以及发布流程(ionic3适用)
  • idea中的.idea文件夹以及*.iml文件(新版idea没有*.iml文件了),新旧版idea打开同一个项目会不会出现不兼容
  • 高性能网络编程 - The C10K problem 以及 网络编程技术角度的解决思路
  • uniapp u-tabs表单如何默认选中
  • 2023年腾讯云双11活动入口在哪里?
  • Windows 下编译 TensorFlow 2.12.0 CC库
  • Spring Boot 中自动装配机制的原理
  • 如何安装Wnmp并结合内网穿透实现外网访问内网Wnmp服务
  • 网工内推 | 上市公司,云平台运维,IP认证优先,13薪
  • Linux安装DMETL4
  • Python中编码声明的方法
  • css设置浏览器表单自动填充时的背景
  • windows系统下查看安卓apk的sha1
  • openGauss学习笔记-116 openGauss 数据库管理-设置数据库审计-审计概述
  • python编程复习系列——week2(Input Output (2))
  • 为什么HTTP用得很好的,开始普及HTTPS呢?
  • C++day6作业
  • 【 毕设项目源码推荐 javaweb 项目】 基于 springboot+vue 的图书个性化推荐系统的设计与实现(springboot003)
  • FFmpeg编译hevc版本,支持mac、linux系统
  • AI系统ChatGPT程序源码+AI绘画系统源码+支持GPT4.0+Midjourney绘画+已支持OpenAI GPT全模型+国内AI全模型
  • Unity 3D 调整cube的颜色
  • 数字通信和fpga概述——杜勇版本学习笔记
  • 17.复制字符串 ,包括\0
  • C# List<T>.IndexOf()方法的使用
  • 深入理解JVM虚拟机第十八篇:JVM种局部变量表结构的认识
  • zabbix监控安装-linux
  • 7+差异分析+WGCNA+PPI网络,学会了不吃亏
  • 接口自动化测试
  • SPASS-描述性分析
  • kafka-go操作kafka