naive-ui/demo/documentation/components/dialog/enUS/use-component.demo.md
2020-10-22 18:14:09 +08:00

603 B

Use as a Component

Sometimes you may want to use a component.

<n-dialog
  title="Confirm"
  content="Are you sure?" 
  :closable="false"
  negative-text="Cancel"
  positive-text="Submit"
  @positive-click="handlePositiveClick"
  @negative-click="handleNegativeClick"
/>
export default {
  inject: ['message'],
  methods: {
    handleNegativeClick () {
      this.message.warning('Cancel')
      this.isActive = false
    },
    handlePositiveClick () {
      this.message.success('Confirm')
      this.isActive = false
    }
  }
}
.n-button {
  margin: 0 12px 8px 0;
}