fix: the button's loading property without delay (#3194)

Co-authored-by: caiyong <caiyong@ihomefnt.com>
pull/3206/head
nanjingcaiyong 2020-11-17 21:45:21 +08:00 committed by GitHub
parent 8da63a6a24
commit 87e59853bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

@ -27,22 +27,25 @@ export default defineComponent({
large: 'lg',
small: 'sm',
},
sLoading: !!this.loading,
sLoading: false,
hasTwoCNChar: false,
};
},
watch: {
loading(val, preVal) {
if (preVal && typeof preVal !== 'boolean') {
clearTimeout(this.delayTimeout);
}
if (val && typeof val !== 'boolean' && val.delay) {
this.delayTimeout = setTimeout(() => {
loading: {
handler(val, preVal) {
if (preVal && typeof preVal !== 'boolean') {
clearTimeout(this.delayTimeout);
}
if (val && typeof val !== 'boolean' && val.delay) {
this.delayTimeout = setTimeout(() => {
this.sLoading = !!val;
}, val.delay);
} else {
this.sLoading = !!val;
}, val.delay);
} else {
this.sLoading = !!val;
}
}
},
immediate: true,
},
},
mounted() {