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

573 B

使用组件

有的时候你可能想把它用作一个组件

<n-confirm
  title="确认"
  content="你确定" 
  :closable="false"
  positive-text="确认"
  @positive-click="submitCallback"
  @negative-click="cancelCallback"
  negative-text="不确认">
</n-confirm>
export default {
  methods: {
    cancelCallback () {
      this.$NMessage.warning('取消')
      this.isActive = false
    },
    submitCallback () {
      this.$NMessage.success('确认')
      this.isActive = false
    }
  }
}
.n-button {
  margin: 0 12px 8px 0;
}