当前位置:网站首页>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
边栏推荐
- 41. 缺失的第一个正数
- 1217_使用SCons生成目标文件
- SiteServer CMS5. 0 Usage Summary
- 102. 二叉树的层序遍历
- 为什么有些人说单片机简单,我学起来这么吃力?
- Compilation principle first set follow set select set prediction analysis table to judge whether the symbol string conforms to the grammar definition (with source code!!!)
- SystemVerilog (VI) - variable
- 编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
- 440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
- Cross domain settings of Chrome browser -- including new and old versions
猜你喜欢
JVM class loading mechanism
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】
394. 字符串解码-辅助栈
JS parsing and execution process
开源按键组件Multi_Button的使用,含测试工程
Kubernetes 服务发现 监控Endpoints
Flask项目的部署详解
EasymodbusTCP之clientexample解析
Halo open source project learning (II): entity classes and data tables
随机推荐
[appium] write scripts by designing Keyword Driven files
48. Rotate image
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
239. Maximum value of sliding window (difficult) - one-way queue, large top heap - byte skipping high frequency problem
122. The best time to buy and sell stocks II - one-time traversal
958. 二叉树的完全性检验
Future 用法详解
JS implementation private attribute
JVM类加载机制
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
Flask项目的部署详解
[二叉数] 二叉树的最大深度+N叉树的最大深度
JS forms the items with the same name in the array object into the same array according to the name
470. Rand10() is implemented with rand7()
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
Open futures, open an account, cloud security or trust the software of futures companies?
402. 移掉 K 位数字-贪心
Manually implement simple promise and its basic functions
1217_ Generating target files using scons