<template>
  <div class="demo-modal-basic">
    <ui-button @click="handleClick">
      打开弹窗
    </ui-button>
    <ui-modal
      :visible.sync="visible">
      <div>
        点击 <a
          href="###"
          @click="handleClick2">
          此处
        </a> 打开另一个弹窗
      </div>

      <ui-modal
        :before-close="beforeClose"
        :visible.sync="visible2">
        <div>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing.Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt nostrud ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</div>
      </ui-modal>
    </ui-modal>
  </div>
</template>

<script>
import { Modal, Button, Dialog } from "amumu-ui"
import { dialog } from "amumu-ui/src/factory"

export default {
  components: {
    "ui-button": Button,
    "ui-modal": Modal,
  },
  data() {
    return {
      visible: false,
      visible2: false,
    }
  },
  methods: {
    handleClick() {
      this.visible = true
    },
    handleClick2(event) {
      event.preventDefault()
      this.visible2 = true
    },
    beforeClose() {
      return dialog.confirm({
        title: "关闭提醒",
        type: "warning",
        message: "确定关闭吗？",
      })
    },
  },
}
</script>
