字数监控,价格监控等
生活随笔
收集整理的這篇文章主要介紹了
字数监控,价格监控等
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?1.textarea輸入字?jǐn)?shù)監(jiān)控(在watch里可監(jiān)控,但有些耗費(fèi)性能,所以節(jié)流)
<div class="gorder-note"><label>備注 <span style="color:#777;font-size: 14px"> {{remarkLen}}/65</span></label><textarea placeholder="請(qǐng)輸入備注.." v-model="remark" @input="descInput"></textarea><!--跳轉(zhuǎn)前存,回來(lái)的時(shí)候再取--> </div>/*備注輸入字?jǐn)?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à)格監(jiān)控(小數(shù)點(diǎn)后兩位) <div><label>合同價(jià)格(元)<span>*</span></label><input type="text" placeholder="請(qǐng)輸入" v-model="contractPrice" @blur="compInput"> </div>/*合同價(jià)格輸入監(jiān)控*/ // 小數(shù)點(diǎn)后兩位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("請(qǐng)輸入正確價(jià)格");this.contractPrice = "";}}else{ // 針對(duì)iOS做空處理this.contractPrice = "";}},?
總結(jié)
以上是生活随笔為你收集整理的字数监控,价格监控等的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: JS数组遍历-forEach()、map
- 下一篇: webpack打包---报错内存溢出ja