当前位置:网站首页>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
边栏推荐
- Summary of common server error codes
- 关于gcc输出typeid完整名的方法
- 2022年上海市安全员C证操作证考试题库及模拟考试
- Sword finger offer 22 The penultimate node in the linked list - speed pointer
- On the problem of V-IF display and hiding
- SystemVerilog (VI) - variable
- 470. Rand10() is implemented with rand7()
- 440. 字典序的第K小数字(困难)-字典树-数节点-字节跳动高频题
- 2022 tea artist (primary) examination simulated 100 questions and simulated examination
- On the method of outputting the complete name of typeID from GCC
猜你喜欢

JS get link? The following parameter name or value, according to the URL? Judge the parameters after

Halo 开源项目学习(二):实体类与数据表

Flask项目的部署详解

2021 Great Wall Cup WP

102. Sequence traversal of binary tree

MySQL进阶之索引【分类,性能分析,使用,设计原则】

Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory

Advantages and disadvantages of several note taking software

SystemVerilog (VI) - variable

MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】
随机推荐
Sword finger offer 03 Duplicate number in array
Index: teach you index from zero basis to proficient use
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
flink 学习(十二)Allowed Lateness和 Side Output
122. The best time to buy and sell stocks II - one-time traversal
102. Sequence traversal of binary tree
ECMAScript history
Learning record of uni app dark horse yougou project (Part 2)
48. 旋转图像
587. 安装栅栏 / 剑指 Offer II 014. 字符串中的变位词
Detailed deployment of flask project
Vite configure proxy proxy to solve cross domain
Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag
Double pointer advanced -- leetcode title -- container with the most water
QT modification UI does not take effect
470. Rand10() is implemented with rand7()
92. Reverse linked list II byte skipping high frequency question
列錶的使用-增删改查
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
31. 下一个排列