Modal 对话框点击确定按钮后,对话框会自动消失,如果想阻止它消失,官方给出的解决方案是给 Modal 添加属性 loading,实现方式如下所示:
<template>
<Button type="primary" @click="modal1 = true">展示Modal</Button>
<Modal
v-model="modal1"
title="Title"
:loading="loading"
@on-ok="modalOK">
<p>After you click ok, the dialog box will close in 2 seconds.</p>
</Modal>
</template>
<script>
export default {
data () {
return {
modal1: false,
loading: true
}
},
methods: {
modalOK() {
setTimeout(() => {
this.modal1 = false;