import { ElLoading } from 'element-plus'
import {nextTick} from "vue";

let loadingInstance
export function showLoading(options){


 let op = {
  target:'body',
  background:"rgba(255, 255, 255, 0.15)",
  text:'Loading...'
 }
 if (loadingInstance){
  loadingInstance.close()
 }
 loadingInstance  = ElLoading.service({
  ...op,
  ...options
 })

 return loadingInstance

}
export function closeShowLoading() {
 nextTick(() => {
  loadingInstance.close()
 })
}
