<template>
  <h1>加载中</h1>
  <button class="btn btn-default" @click="start">开始</button>
  <button class="btn btn-default" @click="startAndStop">定时关闭</button>
  <button class="btn btn-default" @click="start2">打开2个loading</button>
  <Loading v-if="loading" />
</template>

<script>

import Loading from '@/loading/index.js';

export default {

  components: {
    Loading,
  },
  data: function () {
    return {
      loading: false,
    };
  },

  methods: {
    start: function(){
      this.loading = true;
    },
    startAndStop: function(){
      this.loading = true;
      let _self = this;
      window.setTimeout(function(){
        _self.loading = false;
      }, 5000);
    },
  },
};
</script>
