VEUI

VEUI on GitHub
中文

ConfirmBox

Demos

The title and content are both customizable.

Edit this demo on GitHubEdit
<template>
<article>
  <veui-button @click="open = true">
    Remove
  </veui-button>
  <veui-confirm-box
    title="System Notification"
    :open.sync="open"
    @ok="ok"
    @cancel="cancel"
  >
    <p>Are you sure to remove the item?</p>
  </veui-confirm-box>
</article>
</template>

<script>
import { ConfirmBox, Button, toast } from 'veui'

export default {
  components: {
    'veui-confirm-box': ConfirmBox,
    'veui-button': Button
  },
  data () {
    return {
      open: false
    }
  },
  methods: {
    ok () {
      this.open = false
      toast.info('Confirmed')
    },
    cancel () {
      toast.info('Canceled')
    }
  }
}
</script>

API

Props

NameTypeDefaultDescription
openbooleanfalse

.sync

Whether the confirm box is displayed.

titlestring=-The title of the confirm box.
loadingboolean=falseWehter the confirm box is in loading state. When loading, the OK button will enter loading state as well and become unclickable.
disabledboolean=falseWehter the confirm box is disabled. When disabled, the OK button will be disabled as well and become unclickable.
ok-labelstring=-The text content of the “OK” button.
cancel-labelstring=-The text content of the “Cancel” button.
before-closefunction(string): boolean=|Promise<boolean=>-Executed when user interaction is about to trigger closing the confirm box. See the before-close prop of the Dialog component.
overlay-classstring | Array | Object=-See the overlay-class prop of the Overlay component.
overlay-stylestring | Array | Object=-See the overlay-style prop of the Overlay component.

Slots

NameDescription
defaultThe content of the confirm box.
titleThe title of the confirm box. Will ignore the title prop when specified.
footThe foot area of the confirm box. Displays an “OK” and a “Cancel” button by default.

Events

NameDescription
okTriggered when the “OK” button is clicked.
cancelTriggered when the “Cancel” button is clicked.
afteropenTriggered after the box overlay is opened. The box content won't be rendered until after the overlay is opened, so if there is logic that depends on content rendering, please execute it after this event is triggered.
aftercloseTriggered after the box overlay is closed. If leaving transition is provided by the theme, the event will be triggered after the transition completes.
Edit this page on GitHubEdit
© Baidu, Inc. 2023