当前位置:网站首页>Amount input box, used for recharge and withdrawal
Amount input box, used for recharge and withdrawal
2022-04-23 17:49:00 【Sanxiaochi 513】
Encapsulate as a function , Hang up Vue On the prototype
// Amount input
function cash(e){
let price = e.toString()
// When you enter the decimal point directly, it is converted to '0.'
if(price.indexOf('.') == 0){
price = price.replace(/[^$#$]/g,'0.')
}
// First multiple 0 Turn into a
price = price.replace(/^0{1,}/g,'0')
// Convert consecutive decimal points into one
price = price.replace(/\.{2,}/g,'.')
// Only two decimal places
price = price.match(/^\d*\.?\d{0,2}/g)[0]
return price
}
Vue.prototype.$cash = cash
Listen for input events in the input box
input(e){
this.$nextTick(() => {
this.cash = this.$cash(e)
})
},
版权声明
本文为[Sanxiaochi 513]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230550325319.html
边栏推荐
- In ancient Egypt and Greece, what base system was used in mathematics
- Ring back to origin problem - byte jumping high frequency problem
- 958. Complete binary tree test
- 为什么有些人说单片机简单,我学起来这么吃力?
- This point in JS
- 古代埃及希腊,数学用的什么进制
- JS parsing and execution process
- 双闭环直流调速系统matlab/simulink仿真
- Entity Framework core captures database changes
- QT modification UI does not take effect
猜你喜欢

Cross domain settings of Chrome browser -- including new and old versions

C1小笔记【任务训练篇二】

48. Rotate image

Gaode map search, drag and drop query address

MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】

Why do some people say SCM is simple and I have to learn it so hard?

2022制冷与空调设备运行操作判断题及答案

Client example analysis of easymodbustcp

索引:手把手教你索引从零基础到精通使用

Halo 开源项目学习(二):实体类与数据表
随机推荐
Where is the configuration file of tidb server?
122. 买卖股票的最佳时机 II-一次遍历
干货 | 快速抽取缩略图是怎么练成的?
Oil monkey website address
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
油猴网站地址
122. The best time to buy and sell stocks II - one-time traversal
JS interview question: FN call. call. call. Call (FN2) parsing
JS implementation private attribute
Learning record of uni app dark horse yougou project (Part 2)
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
Kubernetes 服务发现 监控Endpoints
Allowed latency and side output
Entity Framework core captures database changes
开源按键组件Multi_Button的使用,含测试工程
Uniapp custom search box adaptation applet alignment capsule
JS forms the items with the same name in the array object into the same array according to the name
练习:求偶数和、阈值分割和求差( list 对象的两个基础小题)
Arithmetic expression
239. Maximum value of sliding window (difficult) - one-way queue, large top heap - byte skipping high frequency problem