import { ElLoading } from 'element-plus'
import { Loading } from '@element-plus/icons-vue'
let loading: ReturnType<typeof ElLoading.service> | null = null

export const openLoading = (options: { text?: string } = {}) => {
  const text = options.text || '加载中'
  loading = ElLoading.service({
    lock: true,
    text: text,
  })
}
export const closeLoading = () => {
  loading && loading.close()
}
