注意:以下文档只适用于TOP接口,请谨慎使用!
1 2 3 4 5 6 7 | import { Loading } from 'genie-ui' // 开始全局加载 Loading.open() // 关闭全局加载 Loading.close() |
也可以使用插件方式加载
1 2 3 4 5 6 7 8 9 | Vue.use(Loading) Vue.extend({ methods: { xxx: { this .$loading.open() } } }) |
事件名称 | 说明 | 回调参数 |
---|---|---|
open | (options) | 打开全局 Loading 状态 |
close | 无 | 关闭全局 Loading 状态 |
options 支持 text 和 duration 两个可选参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <template> <div> <button @click = "showLoading" >点击显示 Loading</button> </div> </template> <script> import { Loading } from 'genie-ui' export default { components: { }, methods: { showLoading (v) { console.log( 'opening' ) Loading.open({ text: '加载中...' , // 可选 // NOTE: 可以使用 duration 定时关闭,也可以调用 close 手动关闭 // duration: 5000 }) setTimeout(function () { console.log( 'closing' ) Loading.close() }, 5000 ) } } } </script> |