- vue 限制只能输入名称32位中文,手机号11位数字,验证码6位数字
watch: {
'bindForm.name'(val) {
let pattern = /[^\u4e00-\u9fa5]+/
this.bindForm.name = val.replace(pattern, '')
if (val.length > 32) {
this.bindForm.name = val.substring(0, 32)
}
this.checkIsComplete()
},
'bindForm.phone'(val) {
if (val.length > 11) {
this.bindForm.phone = val.substring(0, 11)
}
this.checkIsComplete()
},
'bindForm.code'(val) {
if (val.length > 6) {
this.bindForm.code = val.substring(0, 6)
}
this.checkIsComplete()
},
}
- 获取地址栏参数
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
var reg_rewrite = new RegExp('(^|/)' + name + '/([^/]*)(/|$)', 'i')
var r = window.location.search.substr(1).match(reg)
var q = window.location.pathname.substr(1).match(reg_rewrite)
if (r != null) {
return unescape(r[2])
} else if (q != null) {
return unescape(q[2])
} else {
return null
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。