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

uniapp:小程序数字键盘功能样式实现

代码如下:

<template><view><view><view class="money-input"><view class="input-container" @click="toggleBox"><view class="input-wrapper"><view class="input-iconone"><image src="https://picture-warehouseone.oss-cn-beijing.aliyuncs.com/rmb.png" mode="aspectFit"style="width: 60rpx; height: 60rpx;"></image></view><viewstyle="width: auto; height: 100%;line-height: 156rpx; padding-left: 80rpx; font-size: 80rpx; color: #333;">{{nums}}</view><view class="input-icon" :class="{active: showBox}"></view></view></view></view><view class="numbers"><view style=" display: flex; flex-flow: row wrap; justify-content: flex-start; align-content: flex-start; width: 72%; height: auto;"><view @click="changeNums(item,index)" :class="item.class" :style="getListitemstyle(index)"v-for="(item,index) in numbers">{{item.text}}</view></view><view style="width: 28%; height: auto; display: flex; flex-flow: column wrap; "><view @click="jianshao()" class="oner" :style="styleos"><image src="https://picture-warehouseone.oss-cn-beijing.aliyuncs.com/jianshao.png" mode="aspectFit"style="width: 50rpx; height: 50rpx;"></image></view><view class="onerplus" @click="ok()" :style="stylelv">确认</view></view></view></view><view>{{sets}}</view></view>
</template><script>export default {data() {return {active: {background: ' #f2f2f2',color: '#d4d4d4'}, //这是确定按钮的样式styleos: {background: '#ffffff' //这是确认的初始颜色},stylelv: {background: '#9cd7b7' //确认按钮颜色初始},nums: '',sets:this.set,//获取set中编辑数据isimit: false, //判断备注是否超过了最大限制标志位showBox: false, //是否显示‘|’		activeIndex: 0, //默认选中索引sumindex: -1, //数字键盘索引numbers: [{text: '1',class: 'oner',background: '#ffffff'},{text: '2',class: 'oner',background: '#ffffff'},{text: '3',class: 'oner',background: '#ffffff'},{text: '4',class: 'oner',background: '#ffffff'},{text: '5',class: 'oner',background: '#ffffff'},{text: '6',class: 'oner',background: '#ffffff'},{text: '7',class: 'oner',background: '#ffffff'},{text: '8',class: 'oner',background: '#ffffff'},{text: '9',class: 'oner',background: '#ffffff'},{text: '0',class: 'big',background: '#ffffff'},{text: '.',class: 'oner',background: '#ffffff'},]}},created() {},methods: {comfors() {if (this.valuemark) {this.active.background = "#33955f"setTimeout(() => {this.active.background = "#3eb575"this.showremark = false}, 150)}},input(e) {console.log('输入内容:', e);// console.log('this.index.lenth', this.value.length)this.valuemark = eif (this.valuemark) {this.active.background = '#3eb575'this.active.color = '#ffffff'} else {this.active.background = '#f2f2f2'this.active.color = '#d4d4d4'}},ok() {this.stylelv.background = '#3bab6f'setTimeout(() => {this.stylelv.background = '#9cd7b7'}, 150)},jianshao() {this.styleos.background = '#f7f7f7'setTimeout(() => {this.styleos.background = '#ffffff'}, 150)if (this.nums) {this.nums = this.nums.substring(0, this.nums.length - 1)}},changeNums(item, index) {this.numbers.forEach((item, idx) => {if (idx === index) {item.background = '#f7f7f7';setTimeout(() => {item.background = '#ffffff';}, 150)}});this.sumindex = index// console.log('this.sumindex', this.sumindex)if (item.text == '.') {console.log(this.nums.indexOf(".") != -1)if (this.nums.indexOf(".") != -1 || this.nums.length == 0) {return false}}if (this.nums.split('.') && this.nums.split('.')[1]) {if (this.nums.split('.')[1].length >= 2) {return false}}// this.nums.lengthconsole.log('this.nums.length',this.nums.length)this.nums = this.nums + item.textif(this.nums.length >6){this.nums = this.nums.slice(0,6)uni.showToast({title: '最多只能输入6位数哦',icon: 'none'});return;}},getListitemstyle(index) {return {background: this.numbers[index].background};},toggleBox() {this.showBox = true //点击后输入框出现“|”每隔一段时间闪动},},}
</script><style lang="scss" scoped>.Classify {width: 100%;display: flex;height: 120rpx;margin-top: 10rpx;padding-left: 20rpx;padding-right: 30rpx;align-items: center;margin-bottom: -12rpx;justify-self: flex-start;}.Expenditure {width: auto;height: 60rpx;color: #c7c7c7;font-size: 30rpx;text-align: center;line-height: 60rpx;margin-left: 20rpx;border-radius: 10rpx;background-color: #f7f7f7;padding: 0rpx 20rpx 0rpx 20rpx;}.Expendituretime {width: auto;color: black;display: flex;height: 60rpx;font-size: 30rpx;line-height: 60rpx;margin-left: 32rpx;align-items: center;border-radius: 10rpx;background-color: #f7f7f7;justify-content: space-evenly;padding: 0rpx 15rpx 0rpx 20rpx;}.Expenditurelv {width: auto;height: 60rpx;color: #3eb575;font-size: 30rpx;text-align: center;line-height: 60rpx;margin-left: 20rpx;border-radius: 10rpx;background-color: #ebf7f1;padding: 0rpx 20rpx 0rpx 20rpx;}.ExpenditureH {width: auto;height: 60rpx;color: #f5c53a;font-size: 30rpx;text-align: center;line-height: 60rpx;margin-left: 20rpx;border-radius: 10rpx;background-color: #fdf8eb;padding: 0rpx 20rpx 0rpx 20rpx;}.ExpenditureL {width: auto;height: 60rpx;color: #8c8bc3;font-size: 30rpx;text-align: center;line-height: 60rpx;margin-left: 20rpx;border-radius: 10rpx;background-color: #f1f3f6;padding: 0rpx 20rpx 0rpx 20rpx;}.money-input {width: 100%;height: 150rpx;padding: 0 40rpx 0 40rpx;}.Type {width: 100%;height: 154px;display: flex;margin-top: 20rpx;align-items: center;flex-flow: row wrap;justify-content: flex-start;overflow-y: auto;}.Type-box {display: flex;width: 120rpx;height: 140rpx;align-items: center;flex-flow: column wrap;justify-content: center;margin: 0 0rpx 10rpx 5rpx;}.Typeboxactive {display: flex;width: 120rpx;height: 140rpx;align-items: center;flex-flow: column wrap;justify-content: center;margin: 0 0rpx 10rpx 5rpx;background-color: #cbcbcb;}.inctiveclass {width: 80rpx;display: flex;height: 80rpx;font-size: 22rpx;border-radius: 50%;align-items: center;justify-content: center;background-color: #e7e7e7;}.activeclass {width: 80rpx;display: flex;height: 80rpx;border-radius: 50%;align-items: center;justify-content: center;background-color: #3eb575;}.numbers {width: 100%;display: flex;height: 480rpx;margin-top: 10rpx;background-color: #fafafa;justify-content: flex-start;}.remark {width: 100%;color: #50648a;height: 100rpx;font-size: 32rpx;padding: 20rpx 0 0 30rpx;}.oner {display: flex;width: 165rpx;height: 100rpx;font-size: 34rpx;font-weight: bold;align-items: center;border-radius: 10rpx;justify-content: center;margin: 15rpx auto 5rpx;background-color: #ffffff;}.onerplus {display: flex;width: 165rpx;color: #ffffff;height: 338rpx;font-size: 34rpx;font-weight: bold;align-items: center;border-radius: 10rpx;justify-content: center;margin: 15rpx auto 5rpx;background-color: #9cd7b7;}.big {display: flex;width: 342rpx;height: 100rpx;font-size: 34rpx;font-weight: bold;align-items: center;border-radius: 10rpx;margin: 15rpx auto 5rpx;justify-content: center;background-color: #ffffff;}.input-container {position: relative;width: 100%;height: 156rpx;display: flex;}.input-wrapper {position: relative;width: 100%;height: 100%;border-bottom: 1px solid #ccc;padding: 0 20rpx;box-sizing: border-box;display: flex;justify-content: flex-start;align-items: center;}.input-icon {height: 106rpx;width: 5rpx;background-color: #cbcbcb;display: none;}.active {display: block;animation: blink 1s infinite; //点击后|出现}@keyframes blink {0% {opacity: 0;}50% {opacity: 1;}100% {opacity: 0;}}.input-iconone {position: absolute;top: 50%;left: 2rpx;transform: translateY(-50%);color: #666;}.input-field {width: 100%;height: 100%;line-height: 156rpx;padding-left: 80rpx;font-size: 80rpx;color: #333;}.remarks {width: 68px;height: 30px;display: flex;justify-content: flex-start;align-items: center;}.box-text {display: flex;justify-content: center;color: #c7c7c7;align-items: center;width: 100%;margin-top: 10rpx;height: 40rpx;text-align: center;font-size: 24rpx;}.box-ative {display: flex;justify-content: center;color: #000000;align-items: center;width: 100%;margin-top: 10rpx;height: 40rpx;text-align: center;font-size: 24rpx;}.top {position: relative;width: 100%;height: 30%;}.window {width: 100rpx;height: 100%;display: flex;justify-content: center;align-items: center;position: absolute;}.center {position: relative;width: 100%;height: 30%;display: flex;padding: 0 30rpx 0 30rpx;justify-content: center;align-items: center;}.bottom {width: 100%;height: 40%;position: relative;}.comfors {left: 0;top: 0;right: 0;bottom: 0;margin: auto;position: absolute;width: 380rpx;height: 100rpx;border-radius: 10rpx;background-color: #f2f2f2;display: flex;justify-content: center;align-items: center;color: #d4d4d4;border: 1rpx solid #f2f2f2;}.Record-remarks-number-of-words {position: absolute;left: 30rpx;bottom: -20rpx;color: #d4d4d4;}
</style>

在uniapp中直接运行即可。运行效果:

相关文章:

uniapp:小程序数字键盘功能样式实现

代码如下&#xff1a; <template><view><view><view class"money-input"><view class"input-container" click"toggleBox"><view class"input-wrapper"><view class"input-iconone"…...

python处理csv文件

1.使用 csv_writer.writerow # 导入CSV安装包 import csv# 1. 创建文件对象 f open(文件名.csv,a,encodingutf-8)# 2. 基于文件对象构建 csv写入对象 csv_writer csv.writer(f)# 3. 构建列表头 csv_writer.writerow(["问题","答案"])list_name[] # 4. 写…...

多核多cluster多系统之间缓存一致性概述

目录 1.思考和质疑2.怎样去维护多核多系统缓存的一致性2.1多核缓存一致性2.2多Master之间的缓存一致性2.3dynamIQ架构同一个core中的L1和L2 cache 3.MESI协议的介绍4.ACE维护的缓存一致性5.软件定义的缓存和替换策略6.动图示例 本文转自 周贺贺&#xff0c;baron&#xff0c;代…...

力扣爆刷第91天之hot100五连刷41-45

力扣爆刷第91天之hot100五连刷41-45 文章目录 力扣爆刷第91天之hot100五连刷41-45一、102. 二叉树的层序遍历二、108. 将有序数组转换为二叉搜索树三、98. 验证二叉搜索树四、230. 二叉搜索树中第K小的元素五、199. 二叉树的右视图 一、102. 二叉树的层序遍历 题目链接&#x…...

STM32day2

1.思维导图 个人暂时的学后感&#xff0c;不一定对&#xff0c;没什么东西&#xff0c;为做项目奔波中。。。1.使用ADC采样光敏电阻数值&#xff0c;如何根据这个数值调节LED灯亮度。 while (1){/* USER CODE END WHILE *//* USER CODE BEGIN 3 */adc_val HAL_ADC_GetValue(&a…...

查询IP地址保障电商平台安全

随着电子商务的快速发展&#xff0c;网购已经成为人们日常生活中不可或缺的一部分。然而&#xff0c;网络交易安全一直是人们关注的焦点之一&#xff0c;尤其是在面对日益频发的网络诈骗和欺诈行为时。为了提高网购平台交易的安全性&#xff0c;一种有效的方法是通过查询IP地址…...

使用pytorch实现线性回归(很基础模型搭建详解)

使用pytorch实现线性回归 步骤&#xff1a; 1.prepare dataset 2.design model using Class 目的是为了前向传播forward&#xff0c;即计算y hat&#xff08;预测值&#xff09; 3.Construct loss and optimizer (using pytorch API) 其中计算loss是为了进行反向传播&#xff0…...

【力扣100】【好题】322.零钱兑换 || 01背包完全背包

添加链接描述 思路&#xff1a; dp[j]数组表示的是在金额达到 j 的时候所需要的最小硬币数金额&#xff1a;背包容量&#xff0c;每个硬币的个数都为1&#xff1a;背包中物品的价值&#xff0c;硬币面额&#xff1a;物品重量dp[j]min(dp[j],dp[j-coin]1) class Solution:def …...

工单管理系统建设方案

1.1 系统概述 1.1.1 需求描述 1.1.2 需求分析 1.1.3 重难点分析 1.1.4 重难点解决措施 1.2 系统架构设计 1.2.1 系统架构图 1.2.2 关键技术 1.3 系统功能设计 1.3.1 工单创建 1.3.2 工单管理 1.3.3 工单处理 1.3.4 工单催办 1.3.5 工单归档 1.3.6 工单统计 软件项目全套资料获取…...

什么是农业四情监测设备?

【TH-Q2】智慧农业四情监测设备是一种高科技的农田监测工具&#xff0c;旨在实时监测和管理农田中的土壤墒情、作物生长、病虫害以及气象条件。具体来说&#xff0c;它主要包括以下组成部分&#xff1a; 气象站&#xff1a;用于监测气温、湿度、风速等气象数据&#xff0c;为农…...

Java面试题:请解释Java并发工具包中的主要组件及其应用场景,请描述一个使用Java并发框架(如Fork/Join框架)解决实际问题的编程实操问题

文章标题&#xff1a;《Java内存模型深入解析与多线程并发工具类应用》 引言&#xff1a; 在Java的世界里&#xff0c;掌握内存模型和多线程并发是高级开发者的必备技能。Java内存模型&#xff08;JMM&#xff09;和多线程并发工具包为开发者提供了强大的能力&#xff0c;同时…...

boot应用打包

1.创建项目 2.编写 3.native构建 报错&#xff1a; [WARNING] native:build goal is deprecated. Use native:compile-no-fork instead. [INFO] Found GraalVM installation from GRAALVM_HOME variable. [INFO] Executing: S:\Coding\graalvm-jdk-17_windows-x64_bin\graalv…...

探索数据可视化:Matplotlib 多图布局

多图布局 子视图 import numpy as np import matplotlib.pyplot as pltx np.linspace(0,2*np.pi)plt.figure(figsize(9,6))# 创建子视图 # subplot(2,1,1)表示将当前图形分割成 2 行 1 列的子图网格&#xff0c;并在第 1 个子图位置绘制图形 ax plt.subplot(2,1,1) ax.plot…...

springboot262基于spring boot的小型诊疗预约平台的设计与开发

小型诊疗预约平台 摘 要 现代经济快节奏发展以及不断完善升级的信息化技术&#xff0c;让传统数据信息的管理升级为软件存储&#xff0c;归纳&#xff0c;集中处理数据信息的管理方式。本小型诊疗预约平台就是在这样的大环境下诞生&#xff0c;其可以帮助管理者在短时间内处理…...

Java项目修改源码jar文件(无需反编译)

文章目录 应用场景实现方案实现原理注意事项 应用场景 在项目中用了第三方的jar包&#xff0c;但是jar包内某个类不符合项目业务需求&#xff0c;需要修改第三方jar包源码文件内容。 实现方案 首先我们尝试直接修改jar包源码文件内容时&#xff0c;页面上会提示文件是只读的&a…...

java使用BatchPoints批量写入Influxdb

前言 使用时序数据库influxdb时&#xff0c;我们经常需要写入大量的数据。而单单使用influxDB.write&#xff08;Point&#xff09;进行单条写入时&#xff0c;速度过慢&#xff0c;无法支撑时序数据大量写入的速度。 所以我们需要采用批量的方式进行存储&#xff0c;增加写入…...

Java 集合类的高级特性介绍

在 Java 编程中&#xff0c;了解集合类的高级特性对于编写高效和可维护的代码至关重要。以下是一些你应该知道的 Java 集合类的高级特性&#xff0c;以及简单的例子来说明它们的用法。 1. 迭代器&#xff08;Iterators&#xff09;和列表迭代器&#xff08;ListIterators&#…...

使用Docker搭建Caddy

使用Docker搭建Caddy&#xff0c;可以快速部署一个轻量级的、支持自动HTTPS的web服务器。下面将分别介绍使用Docker CLI和Docker Compose两种方式来搭建Caddy服务器&#xff0c;并给出配置文件示例以及参数解释。 使用Docker CLI搭建Caddy 首先&#xff0c;确保你的系统上已安…...

synchronized是重量级锁???

synchronized作为Java程序员最常用同步工具&#xff0c;很多人却对它的用法和实现原理一知半解&#xff0c;以至于还有不少人认为synchronized是重量级锁&#xff0c;性能较差&#xff0c;尽量少用。 但不可否认的是synchronized依然是并发首选工具&#xff0c;连volatile、CA…...

Linux之线程控制

目录 一、POSIX线程库 二、线程的创建 三、线程等待 四、线程终止 五、分离线程 六、线程ID&#xff1a;pthread_t 1、获取线程ID 2、pthread_t 七、线程局部存储&#xff1a;__thread 一、POSIX线程库 由于Linux下的线程并没有独立特有的结构&#xff0c;所以Linux并…...

还在为音乐管理发愁?这款开源神器让你零成本畅享音乐

还在为音乐管理发愁&#xff1f;这款开源神器让你零成本畅享音乐 【免费下载链接】lx-music-desktop 一个基于 Electron 的音乐软件 项目地址: https://gitcode.com/GitHub_Trending/lx/lx-music-desktop 你是否厌倦了在不同音乐平台之间来回切换&#xff1f;每个月支付…...

Python实战:三步复现文献中的专业colorbar配色方案

1. 为什么需要复现文献中的colorbar&#xff1f; 在科研论文的可视化中&#xff0c;colorbar&#xff08;色标&#xff09;是数据可视化的重要组成部分。它不仅仅是颜色的展示&#xff0c;更是数据范围和分布的直观体现。很多顶级期刊的论文都会使用特定的配色方案&#xff0c…...

nli-distilroberta-base行业基准测试报告:在金融、法律、医疗文本上的专项评估

nli-distilroberta-base行业基准测试报告&#xff1a;在金融、法律、医疗文本上的专项评估 1. 测试背景与目标 自然语言推理(NLI)作为理解文本语义关系的核心技术&#xff0c;在专业领域的应用价值日益凸显。本次测试聚焦nli-distilroberta-base模型在金融、法律、医疗三大专…...

如何用OpCore-Simplify在30分钟内完成黑苹果EFI自动化配置?

如何用OpCore-Simplify在30分钟内完成黑苹果EFI自动化配置&#xff1f; 【免费下载链接】OpCore-Simplify A tool designed to simplify the creation of OpenCore EFI 项目地址: https://gitcode.com/GitHub_Trending/op/OpCore-Simplify 黑苹果&#xff08;Hackintosh…...

终极指南:如何用wiliwili在游戏主机上打造完美B站观影体验 [特殊字符][特殊字符]

终极指南&#xff1a;如何用wiliwili在游戏主机上打造完美B站观影体验 &#x1f3ae;&#x1f4fa; 【免费下载链接】wiliwili 第三方B站客户端&#xff0c;目前可以运行在PC全平台、PSVita、PS4 、Xbox 和 Nintendo Switch上 项目地址: https://gitcode.com/GitHub_Trending…...

3个关键步骤:如何用XXMI启动器统一管理多款热门游戏模组

3个关键步骤&#xff1a;如何用XXMI启动器统一管理多款热门游戏模组 【免费下载链接】XXMI-Launcher Modding platform for GI, HSR, WW and ZZZ 项目地址: https://gitcode.com/gh_mirrors/xx/XXMI-Launcher 你是否曾经为不同游戏的模组管理感到头疼&#xff1f;每个游…...

合宙Air724UG Cat.1模块音频接口实战解析--从硬件设计到软件调试

1. 合宙Air724UG音频接口硬件设计详解 第一次拿到合宙Air724UG模块时&#xff0c;最让我头疼的就是音频接口部分的设计。这个Cat.1模块内置了完整的语音处理功能&#xff0c;但要把这些功能用好&#xff0c;硬件设计上有很多需要注意的细节。我花了整整两周时间调试&#xff0c…...

Android AAudio低延迟音频流实战:从独占模式到性能调优

1. AAudio低延迟音频流的核心价值 在移动音频开发领域&#xff0c;延迟是影响用户体验的关键指标。想象一下你正在玩一款音乐游戏&#xff0c;每次敲击屏幕到听到声音反馈的时间如果超过20毫秒&#xff0c;就会明显感觉到操作和声音不同步。这就是AAudio诞生的背景——它专为解…...

17层视频叠加实战:用Xilinx Video Mixer IP实现多画面融合的完整配置流程

17层视频叠加实战&#xff1a;Xilinx Video Mixer IP核心配置与性能优化指南 在超高清视频处理领域&#xff0c;多画面融合技术正成为专业视听系统的标配能力。Xilinx Video Mixer IP凭借其17层实时叠加能力&#xff0c;为4K/8K视频墙、AR信息叠加、多源监控等场景提供了硬件级…...

Alibaba DASD-4B Thinking 对话工具在时序预测中的应用:结合LSTM模型的分析与报告生成

Alibaba DASD-4B Thinking 对话工具在时序预测中的应用&#xff1a;结合LSTM模型的分析与报告生成 1. 引言 想象一下这个场景&#xff1a;你的团队刚刚用LSTM模型跑完了下个季度的销量预测&#xff0c;屏幕上那条起伏的曲线清晰地告诉你&#xff0c;三月份会有一个销售高峰&a…...