当前位置:网站首页>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
边栏推荐
- 122. The best time to buy and sell stocks II - one-time traversal
- SiteServer CMS5. 0 Usage Summary
- In embedded system, must the program code in flash be moved to ram to run?
- Element calculation distance and event object
- 极致体验,揭晓抖音背后的音视频技术
- This point in JS
- 239. 滑动窗口最大值(困难)-单向队列、大顶堆-字节跳动高频题
- HCIP第五次实验
- Ring back to origin problem - byte jumping high frequency problem
- Dry goods | how to extract thumbnails quickly?
猜你喜欢
随机推荐
嵌入式系统中,FLASH中的程序代码必须搬到RAM中运行吗?
MySQL installation
Client example analysis of easymodbustcp
列表的使用-增删改查
470. 用 Rand7() 实现 Rand10()
Commonly used functions -- spineros:: and spineros::)
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
386. Dictionary order (medium) - iteration - full arrangement
587. Install fence / Sword finger offer II 014 Anagrams in strings
開期貨,開戶雲安全還是相信期貨公司的軟件?
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
198. 打家劫舍-动态规划
flink 学习(十二)Allowed Lateness和 Side Output
Vite configure proxy proxy to solve cross domain
48. Rotate image
41. 缺失的第一个正数
JVM类加载机制
Type judgment in [untitled] JS
stm32入门开发板选野火还是正点原子呢?
Entity Framework core captures database changes









