代码拉取完成,页面将自动刷新
/*- coding = utf-8 -*-
@Time : 2023/7/4 14:27
@Author : 管茂良
@File : index.ts
@web : www.php-china.com
@Software: WebStorm
*/
import Loading from "@/components/loading/index"
import {createApp, ref} from "vue";
import {modeType} from "@/components/loading/types";
interface propsInterface{
isShowLoading?:boolean,
loadingMode?:modeType,
loadingSize?:number,
loadingTitle?:string,
}
const parentNode = document.createElement('div')
parentNode.setAttribute("id","loading-style")
let options = ref<propsInterface>({
isShowLoading:false,
loadingMode:"circle",
loadingSize:60,
loadingTitle:"加载中...",
})
const handleLoad = ()=> {
const loadingInstance =(options?:any)=>{
return createApp(Loading,{
...options
})
}
const show = (obj?:propsInterface)=>{
options.value = {...obj}
options.value.isShowLoading = true;
document.body.appendChild(parentNode)
loadingInstance(options.value).mount(parentNode)
}
const hide = () => {
options.value.isShowLoading = false;
let loadingStyle = document.querySelector("#loading-style")
document.body.removeChild(loadingStyle)
}
return {show,hide}
}
export default handleLoad
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。