<template>
  <div>
    <button @click="showLoading">点击显示 Loading</button>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
import { Loading } from '../../tunas'

Vue.use(Loading)

export default Vue.extend({
  components: {
  },

  methods: {
    showLoading (v) {
      console.log('opening')
      this.$loading.open({
        text: '加载中...',
        type: 'genieLoading',
        // NOTE: 可以使用 duration 定时关闭，也可以调用 close 手动关闭
        // duration: 5000
      })

      setTimeout(() => {
        console.log('closing')
        this.$loading.close()
      }, 2500)
    }
  }
})
</script>
