//用来显示对应id的编辑内容,在created中调用
fetchManage(id){
this.$http.get('http://localhost:3000/manage/'+id)
.then(function (response) {
this.manage=response.body;
})
},
editManage(e){
if(!this.manage.account||!this.manage.username||!this.manage.password||!this.manage.authority){
this.$layer.msg("请添加对应信息!")
}else{
let updateManage={
account:this.manage.account,
username:this.manage.username,
password:this.manage.password,
authority:this.manage.authority
}; this.$http.put("http://localhost:3000/manage/"+this.info.id,updateManage)
.then(function (response) {
//关闭父组件中的编辑弹框
this.$layer.close(this.layerid);
//弹出提示信息,默认时间为3秒
this.$layer.msg("修改管理员信息成功!");
});
e.preventDefault()
}
e.preventDefault()
}
},
created(){
// this.info.id父组件传给子组件的id值
this.fetchManage(this.info.id);
}
}
</script>
<style scoped>
.editmanage{
margin:8px 20px 20px 20px;
}
</style>
到此这篇关于Vue项目结合Vue-layer实现弹框式编辑功能(实例代码)的文章就介绍到这了,更多相关Vue弹框式编辑内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!










