<template>
  <div class="demo-message-type">
    <ui-button
      @click="handleClick('success')">
      Success
    </ui-button>
    <ui-button
      @click="handleClick('warning')">
      Warning
    </ui-button>
    <ui-button
      @click="handleClick('error')">
      Error
    </ui-button>
  </div>
</template>

<script>
import { Button } from "amumu-ui"
import { message } from "amumu-ui/src/factory"
export default {
  components: {
    "ui-button": Button,
  },
  methods: {
    handleClick(type) {
      const vm = message[type]("提示内容。")

      if (type === "loading") {
        setTimeout(() => {
          vm.close()
        }, 3000)
      }
    },
  },
}
</script>
<style lang="scss">
.demo-message-type {
  .mm-button {
    margin-right: 20px;
  }
}
</style>
