已解决
saveTitle可以获取到event
//组件OK的方法,将event传递过去
ok (event) {
console.log(event);
this.$emit('ok',event);
if (this.closeWhenOK) {
this.show = false;
}
},
methods:{
show(){
this.showModal=true;
},
close(){
this.showModal=false;
},
saveTitle:function(event){
var _vm=this;
console.log(event);
this.$validate(true, function () {
console.log('validate done !!')
if (_vm.$valid.invalid) {
event.preventDefault()
//return false;
}
});
$.post("http://localhost:14322/api/titleManage/create",_vm.title,function(data){
if(data&&data.success){
console.log(data.data);
_vm.showModal=false;
_vm.getData();
console.log(_vm.showModal);
}else{
var errs=[];
data.errMsg.forEach(function(err){
errs.push({ field: err.name, message: err.msg });
});
_vm.$setValidationErrors(errs);
}
});
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
已解决,已更改问题