vue+ElementUI 닫기 대화 상자 비우기 인증, 폼 지우기
1. 우선 대화상자 취소 단추에 클릭 이벤트를 추가합니다. 예를 들어 (ps::callOf에 있는addGroupData와ref가 일일이 대응합니다.)
<div slot="footer" class="dialog-footer">
<el-button @click="callOf('addGroupData')"> </el-button>
<el-button type="primary" @click="addgroupList('addGroupData');"> </el-button>
</div>
2. 취소 단추를 누르면 대화상자를 닫고 폼 검증을 지웁니다.
callOf(formName){
this.creatGroup = false;
this.$refs[formName].resetFields();
}
3. 대화상자 오른쪽 상단에 있는close 단추(before-close: 닫기 전의 리셋은 Dialog의 닫기를 멈추고,function(done),done는 Dialog를 닫는 데 사용됩니다.location.reload: 전체 페이지 새로 고침)
closeDialog(done){
this.$confirm(' ?')
.then(_ => {
done();
location.reload();
})
.catch(_ => { });
}
이렇게 설정하면 두 번의 클릭이 일어나지 않을 때 오류 알림이 대화상자에 남아 있습니다추가 지식: vue에서 단추를 멈추고 선택하고 업데이트하면 자동으로 이전의 상태를 회복합니다
잔말 말고 코드 봐~
<template>
//
//
<Button class="dict-hold" :class="{dict_hold_active:isActive}" @click="saveDict"> </Button>
</template>
<script>
export default {
data() {
return{
isActive:false
}
},
methods: {
saveDict() {
var thiz = this;
thiz.isActive=true;
console.log(' ', this.selectDict);
if (!this.selectDict || this.selectDict.unid === '0') {
thiz.$Message.error(' , ');
return false;
}
if (!this.selectDict.dictName) {
thiz.$Message.error(' ');
return false;
}
if (this.selectDict.dictSortid == null) {
thiz.$Message.error(' ');
return false;
}
if (!this.currIsType && !this.selectDict.dictValue) {
thiz.$Message.error(' ');
return false;
}
this.$store.dispatch('axios_re', {
type: 'post',
url: '/address/updateDict',
data: {
unid: this.selectDict.unid,
dictName: this.selectDict.dictName,
},
success: function (res) {
thiz.$Message.success(' ');
thiz.selectDict.title = thiz.selectDict.dictName;
thiz.isActive=false;
},
fail: function (err) {
thiz.$Message.error(' ');
thiz.isActive=false;
}
});
}
}
}
</script>
<style lang="scss" scoped>
.dict-hold {
margin-left: 35px;
width: 90px;
height: 32px;
background:rgba(57, 97, 244, 1);
&:hover{
background-color: #7295FF;
}
}
.dict_hold_active{
margin-left: 35px;
width: 90px;
height: 32px;
background-color: #7295FF;
}
</style>
상기 vue+ElementUI 닫기 대화상자 비우기 검증,form 폼을 지우는 작업은 모든 내용을 공유하는 것입니다. 참고해 주시고 저희를 많이 사랑해 주십시오.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Fastapi websocket 및 vue 3(Composition API)1부: FastAPI virtualenv 만들기(선택 사항) FastAPI 및 필요한 모든 것을 다음과 같이 설치하십시오. 생성main.py 파일 및 실행 - 브라우저에서 이 링크 열기http://127.0.0.1:...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.