naive-ui/demo/documentation/components/modal/enUS/mask-closable.demo.md
2020-12-12 15:33:41 +08:00

776 B

Mask Closable

Use mask-closable=false to make modal not emit the event which may close the modal.

<n-button @click="modalActive = true"> Start Me up </n-button>
<n-modal
  v-model:show="modalActive"
  :mask-closable="false"
  preset="confirm"
  title="Dialog"
  content="Are you sure?"
  :closable="false"
  positive-text="Confirm"
  @positive-click="submitCallback"
  @negative-click="cancelCallback"
  negative-text="Cancel"
/>
export default {
  inject: ['message'],
  data () {
    return {
      modalActive: false
    }
  },
  methods: {
    cancelCallback () {
      this.message.success('Cancel')
      this.modalActive = false
    },
    submitCallback () {
      this.message.success('Submit')
      this.modalActive = false
    }
  }
}