正则表达式+验证IP地址合法性
ipCheck:function(){
var reg = /^91\d{2}|2[0-4]\d|25[0-5][1-9]\d|[1-9](\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)){3}$/
var re = new RegExp(reg)
if(this.form.ipAddress==null || this.form.ipAddress==''){
this.$message({
type: 'warning',
message: 'ip不可为空! ',
duration: 10000,
showClose: true,
})
return false;
}
if(!re.test(this.form.ipAddress)){
this.$message({
type: 'warning',
message: '请填写有效的IP地址! ',
duration: 10000,
showClose: true,
})
return false;
}
},