naive-ui/demo/documentation/components/confirm/enUS/async.md
2020-02-04 13:23:36 +08:00

550 B

Async

Confirm can be async.

<n-button @click="handleClick">
  Success
</n-button>
.n-button {
  margin: 0 12px 8px 0;
}
export default {
  methods: {
    handleClick(e) {
      const confirmInstance = this.$NConfirm.success({
        title: 'Async',
        content:
          'Click and count down 3 second',
        onPositiveClick: hide => {
          confirmInstance.loading = true
          this.$NMessage.success('Count down 3 second')
          window.setTimeout(hide, 3000)
        }
      })
    }
  }
}