标签:ret info 自定义 inf mod select color return sub
效果如下:
html:
<input type="text" value="1" v-model="page.page_my_selected" @blur="onBlur">
js:
dara(){ return { page:{page_my_selected:1} } } onBlur() { if ( this.page.page_my_selected == null || this.page.page_my_selected == undefined || this.page.page_my_selected == "" ) { this.page.page_my_selected = 1; } let reg = /^\d+$/; // 输入字符串 if (!reg.test(this.page.page_my_selected)) { if (reg.test(this.page.page_my_selected.substr(0, 1))) { this.page.page_my_selected = parseInt(this.page.page_my_selected); } else { this.page.page_my_selected = 1; } } / / console.log(reg.test(this.page.page_my_selected)) },
标签:ret info 自定义 inf mod select color return sub
原文地址:https://www.cnblogs.com/cap-rq/p/10294718.html