|
<template>
<div>
<button @click="showDialog = true">打开弹窗</button>
<dialog v-model="showDialog">
<p>这是一个弹窗</p>
</dialog>
</div>
</template>
<script>
export default {
data() {
return {
showDialog: false
}
},
watch: {
showDialog(val) {
if (val === true) {
setTimeout(() => {
this.showDialog = false
}, 3000)
}
}
}
}
</script>
|
|