当前位置:网站首页>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
边栏推荐
- Future 用法详解
- On the method of outputting the complete name of typeID from GCC
- 239. Maximum value of sliding window (difficult) - one-way queue, large top heap - byte skipping high frequency problem
- 极致体验,揭晓抖音背后的音视频技术
- 開期貨,開戶雲安全還是相信期貨公司的軟件?
- 209. 长度最小的子数组-滑动窗口
- Client example analysis of easymodbustcp
- Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
- 440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
- 122. 买卖股票的最佳时机 II-一次遍历
猜你喜欢
JS get link? The following parameter name or value, according to the URL? Judge the parameters after
MySQL进阶之索引【分类,性能分析,使用,设计原则】
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
Leak detection and vacancy filling (6)
Operation of 2022 mobile crane driver national question bank simulation examination platform
[appium] write scripts by designing Keyword Driven files
Gaode map search, drag and drop query address
土地覆盖/利用数据产品下载
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
随机推荐
Write a regular
Summary of common SQL statements
92. Reverse linked list II byte skipping high frequency question
JS implementation private attribute
Double pointer advanced -- leetcode title -- container with the most water
stm32入门开发板选野火还是正点原子呢?
394. String decoding - auxiliary stack
Sword finger offer 22 The penultimate node in the linked list - speed pointer
386. Dictionary order (medium) - iteration - full arrangement
SiteServer CMS5. 0 Usage Summary
Leak detection and vacancy filling (6)
JS parsing and execution process
MySQL进阶之索引【分类,性能分析,使用,设计原则】
2021 Great Wall Cup WP
Allowed latency and side output
Error in created hook: "referenceerror:" promise "undefined“
Listen for click events other than an element
440. The k-th small number of dictionary order (difficult) - dictionary tree - number node - byte skipping high-frequency question
JS interview question: FN call. call. call. Call (FN2) parsing
ES6 new method