字数监控,价格监控等
生活随笔
收集整理的這篇文章主要介紹了
字数监控,价格监控等
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?1.textarea輸入字數(shù)監(jiān)控(在watch里可監(jiān)控,但有些耗費性能,所以節(jié)流)
<div class="gorder-note"><label>備注 <span style="color:#777;font-size: 14px"> {{remarkLen}}/65</span></label><textarea placeholder="請輸入備注.." v-model="remark" @input="descInput"></textarea><!--跳轉(zhuǎn)前存,回來的時候再取--> </div>/*備注輸入字數(shù)監(jiān)控*/ descInput() {let val = this.remark.length;this.remarkLen = val;if (val > 65) {this.remark = this.remark.substring(0, 65);this.remarkLen = this.remark.length;} }, 2.價格監(jiān)控(小數(shù)點后兩位) <div><label>合同價格(元)<span>*</span></label><input type="text" placeholder="請輸入" v-model="contractPrice" @blur="compInput"> </div>/*合同價格輸入監(jiān)控*/ // 小數(shù)點后兩位compInput() {let re = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;if (!!this.contractPrice || this.contractPrice === 0) {if (!re.test(this.contractPrice)) {this.$toast("請輸入正確價格");this.contractPrice = "";}}else{ // 針對iOS做空處理this.contractPrice = "";}},?
總結(jié)
以上是生活随笔為你收集整理的字数监控,价格监控等的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JS数组遍历-forEach()、map
- 下一篇: 如何还原已删除的 iCloud 联系人、