[improvement] Dialog: support async close (#854)

This commit is contained in:
qianzhaoyan
2018-04-17 10:36:20 +08:00
committed by neverland
parent 4a6d3e5d37
commit f87dd825d7
4 changed files with 51 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
<van-button @click="show = true">{{ $t('advancedUsage') }}</van-button>
<van-dialog
v-model="show"
@confirm="show = false"
:asyncConfirm="onClickConfirmAsync"
>
<van-field
v-model="username"
@@ -59,7 +59,7 @@ export default {
Dialog.alert({
title: this.$t('title'),
message: this.$t('content')
});
})
},
onClickAlert2() {
@@ -73,6 +73,14 @@ export default {
title: this.$t('title'),
message: this.$t('content')
});
},
onClickConfirmAsync() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 1000)
})
}
}
};