naive-ui/demo/documentation/components/modal/enUS/presetConfirm.demo.md
07akioni 487001d697 build: add changelog to site, refactor loader based on suffix
.demo.md for component demo
.demo-entry.md for demo entry
.md for common docs
2020-08-19 23:30:04 +08:00

681 B

Use Preset Confirm

An example of preset confirm.

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