import Vue from 'vue'
import Loading from './alp-loading'
let instance = null
function initLoading () {
if (!instance) {
let MyLoadingComponent = Vue.extend(Loading)
instance = new MyLoadingComponent({
el: document.createElement('section')
})
document.body.appendChild(instance.$el)
}
instance.showLoading = false
}
let loading = {
show (opt) {
instance.$data.value = opt || '加载中...'
instance.showLoading = true
document.body.appendChild(instance.$el)
},
hide () {
instance.showLoading = false
}
}
export default {
install (_vue) {
if (!_vue.$loading) {
initLoading()
_vue.prototype.$loading = loading
}
},
show: loading.show,
hide: loading.hide
}
loading
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- 试例: loading的js引入文件必须放<head>内 html base_loading.js 当页面资源加载...
- 原理:每发送一次请求就+1,每执行完一次请求就-1,最后数字得0 就说明都请求完了
- 实现:页面没加载完出现的loading蒙层 附上代码 <template> </template> exportd...
- redis 服务基本上坑不多,基本上注意一下几点: 主动设置 key 过期时间 注意不要有大 key 最近遇到了一...
- 原先的代码是这样的 但是呢,没有出现预期的结果,loading显示的text还是拼命加载中 so,我就这样干......