vue-stack-tabs 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{types → dist}/src/lib/hooks/useStackTab.d.ts +2 -2
- package/{types → dist}/src/lib/hooks/useTabpanel.d.ts +6 -2
- package/{types → dist}/src/lib/index.d.ts +7 -1
- package/{types → dist}/src/lib/model/TabModel.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/vue-stack-tabs.es.js +2340 -2321
- package/dist/vue-stack-tabs.umd.js +10 -10
- package/package.json +3 -4
- package/src/lib/StackTabs.vue +136 -126
- package/src/lib/assets/style/common/mixins.scss +45 -45
- package/src/lib/assets/style/common/var.scss +65 -65
- package/src/lib/assets/style/icon.scss +93 -93
- package/src/lib/assets/style/index.scss +4 -4
- package/src/lib/assets/style/overlayer.scss +40 -40
- package/src/lib/assets/style/stackTab.scss +395 -395
- package/src/lib/assets/style/transition.scss +40 -40
- package/src/lib/banner.ts +51 -51
- package/src/lib/components/ContextMenu/ContextMenuItem.vue +15 -15
- package/src/lib/components/ContextMenu/index.vue +129 -129
- package/src/lib/components/OverlayLoading/Component.vue +182 -191
- package/src/lib/components/OverlayLoading/api.ts +31 -31
- package/src/lib/components/OverlayLoading/helpers.ts +31 -31
- package/src/lib/components/OverlayLoading/index.ts +12 -12
- package/src/lib/components/OverlayLoading/loaders/bars.vue +79 -79
- package/src/lib/components/OverlayLoading/loaders/dots.vue +92 -92
- package/src/lib/components/OverlayLoading/loaders/index.ts +9 -9
- package/src/lib/components/OverlayLoading/loaders/spinner.vue +41 -41
- package/src/lib/components/TabHeader/TabHeaderButton.vue +35 -35
- package/src/lib/components/TabHeader/TabHeaderItem.vue +63 -63
- package/src/lib/components/TabHeader/TabHeaderScroll.vue +240 -240
- package/src/lib/components/TabHeader/index.vue +135 -135
- package/src/lib/hooks/useContextMenu.ts +50 -50
- package/src/lib/hooks/useStackTab.ts +74 -65
- package/src/lib/hooks/useTabLoading.ts +34 -34
- package/src/lib/hooks/useTabRouter.ts +94 -94
- package/src/lib/hooks/useTabpanel.tsx +516 -491
- package/src/lib/i18n/index.ts +72 -72
- package/src/lib/i18n/lang/en.ts +15 -15
- package/src/lib/i18n/lang/zh-CN.ts +15 -15
- package/src/lib/iframe.vue +7 -7
- package/src/lib/index.ts +32 -23
- package/src/lib/model/TabModel.ts +178 -169
- package/src/lib/utils/TabIdHelper.ts +70 -70
- package/src/lib/utils/TabScrollHelper.ts +104 -104
- package/src/lib/utils/UriHelper.ts +22 -22
- /package/{types → dist}/index.d.ts +0 -0
- /package/{types → dist}/src/lib/StackTabs.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/banner.d.ts +0 -0
- /package/{types → dist}/src/lib/components/ContextMenu/ContextMenuItem.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/ContextMenu/index.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/Component.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/api.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/helpers.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/index.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/loaders/bars.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/loaders/dots.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/loaders/index.d.ts +0 -0
- /package/{types → dist}/src/lib/components/OverlayLoading/loaders/spinner.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/TabHeader/TabHeaderButton.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/TabHeader/TabHeaderScroll.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/components/TabHeader/index.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/hooks/useContextMenu.d.ts +0 -0
- /package/{types → dist}/src/lib/hooks/useTabLoading.d.ts +0 -0
- /package/{types → dist}/src/lib/hooks/useTabRouter.d.ts +0 -0
- /package/{types → dist}/src/lib/i18n/index.d.ts +0 -0
- /package/{types → dist}/src/lib/i18n/lang/en.d.ts +0 -0
- /package/{types → dist}/src/lib/i18n/lang/zh-CN.d.ts +0 -0
- /package/{types → dist}/src/lib/iframe.vue.d.ts +0 -0
- /package/{types → dist}/src/lib/utils/TabIdHelper.d.ts +0 -0
- /package/{types → dist}/src/lib/utils/TabScrollHelper.d.ts +0 -0
- /package/{types → dist}/src/lib/utils/UriHelper.d.ts +0 -0
|
@@ -1,191 +1,182 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition :name="transition">
|
|
3
|
-
<div
|
|
4
|
-
tabindex="0"
|
|
5
|
-
class="vl-overlay vl-active"
|
|
6
|
-
:class="{ 'vl-full-page': isFullPage }"
|
|
7
|
-
v-show="isActive"
|
|
8
|
-
:aria-busy="isActive"
|
|
9
|
-
aria-label="Loading"
|
|
10
|
-
:style="{ zIndex }"
|
|
11
|
-
ref="overlay"
|
|
12
|
-
>
|
|
13
|
-
<div class="vl-background" @click.prevent="cancel" :style="bgStyle" />
|
|
14
|
-
<div class="vl-icon">
|
|
15
|
-
<slot name="before" />
|
|
16
|
-
<slot name="default">
|
|
17
|
-
<component :is="Loaders[loader]" :color="color" :width="width" :height="height" />
|
|
18
|
-
</slot>
|
|
19
|
-
<slot name="after" />
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</transition>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script lang="ts" setup>
|
|
26
|
-
// @ts-nocheck
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
props.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
})
|
|
184
|
-
onBeforeUnmount(() => {
|
|
185
|
-
document.removeEventListener('keyup', keyPress)
|
|
186
|
-
document.removeEventListener('focusin', focusIn)
|
|
187
|
-
})
|
|
188
|
-
defineExpose({
|
|
189
|
-
hide
|
|
190
|
-
})
|
|
191
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<transition :name="transition">
|
|
3
|
+
<div
|
|
4
|
+
tabindex="0"
|
|
5
|
+
class="vl-overlay vl-active"
|
|
6
|
+
:class="{ 'vl-full-page': isFullPage }"
|
|
7
|
+
v-show="isActive"
|
|
8
|
+
:aria-busy="isActive"
|
|
9
|
+
aria-label="Loading"
|
|
10
|
+
:style="{ zIndex }"
|
|
11
|
+
ref="overlay"
|
|
12
|
+
>
|
|
13
|
+
<div class="vl-background" @click.prevent="cancel" :style="bgStyle" />
|
|
14
|
+
<div class="vl-icon">
|
|
15
|
+
<slot name="before" />
|
|
16
|
+
<slot name="default">
|
|
17
|
+
<component :is="Loaders[loader]" :color="color" :width="width" :height="height" />
|
|
18
|
+
</slot>
|
|
19
|
+
<slot name="after" />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</transition>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
// @ts-nocheck
|
|
27
|
+
import { withDefaults, render, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue'
|
|
28
|
+
import { removeElement } from './helpers'
|
|
29
|
+
import Loaders from './loaders'
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(
|
|
32
|
+
defineProps<{
|
|
33
|
+
active: boolean
|
|
34
|
+
programmatic: boolean
|
|
35
|
+
container: HTMLElement | Object | Function
|
|
36
|
+
isFullPage: boolean
|
|
37
|
+
enforceFocus?: boolean
|
|
38
|
+
lockScroll: boolean
|
|
39
|
+
transition: string
|
|
40
|
+
/**
|
|
41
|
+
* Allow user to hide the loader
|
|
42
|
+
*/
|
|
43
|
+
canCancel: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Do something on cancel
|
|
46
|
+
*/
|
|
47
|
+
onCancel: Function
|
|
48
|
+
color: string
|
|
49
|
+
backgroundColor: string
|
|
50
|
+
opacity: number
|
|
51
|
+
width: number
|
|
52
|
+
height: number
|
|
53
|
+
zIndex: number
|
|
54
|
+
loader: string
|
|
55
|
+
}>(),
|
|
56
|
+
{
|
|
57
|
+
isFullPage: true,
|
|
58
|
+
enforceFocus: true,
|
|
59
|
+
transition: 'fade',
|
|
60
|
+
onCancel: () => {},
|
|
61
|
+
loader: 'spinner'
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
const overlay = ref<HTMLDivElement>()
|
|
65
|
+
const isActive = ref<boolean>(props.active)
|
|
66
|
+
const emit = defineEmits(['hide', 'update:active'])
|
|
67
|
+
/**
|
|
68
|
+
* Proxy to hide() method.
|
|
69
|
+
* Gets called by ESC button or when click outside
|
|
70
|
+
*/
|
|
71
|
+
const cancel = () => {
|
|
72
|
+
if (!props.canCancel || !isActive.value) return
|
|
73
|
+
hide()
|
|
74
|
+
props.onCancel.apply(null, null)
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Hide and destroy component if it's programmatic.
|
|
78
|
+
*/
|
|
79
|
+
const hide = () => {
|
|
80
|
+
emit('hide')
|
|
81
|
+
emit('update:active', false)
|
|
82
|
+
|
|
83
|
+
if (props.programmatic) {
|
|
84
|
+
isActive.value = false
|
|
85
|
+
|
|
86
|
+
// Timeout for the animation complete before destroying
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
const parent = overlay.value!.parentElement
|
|
89
|
+
// unmount the component
|
|
90
|
+
render(null, parent!)
|
|
91
|
+
removeElement(parent)
|
|
92
|
+
}, 150)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const disableScroll = () => {
|
|
96
|
+
if (props.isFullPage && props.lockScroll) {
|
|
97
|
+
document.body.classList.add('vl-shown')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const enableScroll = () => {
|
|
101
|
+
if (props.isFullPage && props.lockScroll) {
|
|
102
|
+
document.body.classList.remove('vl-shown')
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Key press event to hide on ESC.
|
|
107
|
+
*/
|
|
108
|
+
const keyPress = (event: KeyboardEvent) => {
|
|
109
|
+
// todo keyCode is deprecated
|
|
110
|
+
if (event.code === 'Escape') cancel()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const focusIn = (event: FocusEvent) => {
|
|
114
|
+
// Ignore when loading is not active
|
|
115
|
+
if (!isActive.value) return
|
|
116
|
+
|
|
117
|
+
if (
|
|
118
|
+
// Event target is the loading div element itself
|
|
119
|
+
event.target === overlay.value ||
|
|
120
|
+
// Event target is inside the loading div
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
overlay.value!.contains(event.target)
|
|
123
|
+
)
|
|
124
|
+
return
|
|
125
|
+
|
|
126
|
+
// Use container as parent when available otherwise use parent element when isFullPage is false
|
|
127
|
+
const parent = props.container
|
|
128
|
+
? props.container
|
|
129
|
+
: props.isFullPage
|
|
130
|
+
? null
|
|
131
|
+
: overlay.value!.parentElement
|
|
132
|
+
|
|
133
|
+
if (
|
|
134
|
+
// Always prevent when loading is full screen
|
|
135
|
+
props.isFullPage ||
|
|
136
|
+
// When a parent exist means loader is running inside a container
|
|
137
|
+
// When loading is NOT full screen and event target is inside the given container
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
(parent && parent.contains(event.target))
|
|
140
|
+
) {
|
|
141
|
+
event.preventDefault()
|
|
142
|
+
overlay.value!.focus()
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const bgStyle = computed(() => {
|
|
147
|
+
return {
|
|
148
|
+
background: props.backgroundColor,
|
|
149
|
+
opacity: props.opacity
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
watch(
|
|
153
|
+
() => props.active,
|
|
154
|
+
(value) => {
|
|
155
|
+
isActive.value = value
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
watch(
|
|
159
|
+
() => isActive,
|
|
160
|
+
(value) => {
|
|
161
|
+
if (value) {
|
|
162
|
+
disableScroll()
|
|
163
|
+
} else {
|
|
164
|
+
enableScroll()
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
onMounted(() => {
|
|
170
|
+
if (props.enforceFocus) {
|
|
171
|
+
document.addEventListener('focusin', focusIn)
|
|
172
|
+
}
|
|
173
|
+
document.addEventListener('keyup', keyPress)
|
|
174
|
+
})
|
|
175
|
+
onBeforeUnmount(() => {
|
|
176
|
+
document.removeEventListener('keyup', keyPress)
|
|
177
|
+
document.removeEventListener('focusin', focusIn)
|
|
178
|
+
})
|
|
179
|
+
defineExpose({
|
|
180
|
+
hide
|
|
181
|
+
})
|
|
182
|
+
</script>
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { createComponent } from './helpers'
|
|
2
|
-
import LoadingComponent from './Component.vue'
|
|
3
|
-
|
|
4
|
-
export const useLoading = (globalProps = {}, globalSlots = {}) => {
|
|
5
|
-
return {
|
|
6
|
-
show(props = globalProps, slots = globalSlots) {
|
|
7
|
-
const forceProps = {
|
|
8
|
-
programmatic: true,
|
|
9
|
-
lockScroll: true,
|
|
10
|
-
isFullPage: false,
|
|
11
|
-
active: true
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const propsData = { ...globalProps, ...props, ...forceProps }
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
let container = propsData.container
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
if (!propsData.container) {
|
|
19
|
-
container = document.body
|
|
20
|
-
propsData.isFullPage = true
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const mergedSlots = { ...globalSlots, ...slots }
|
|
24
|
-
const instance = createComponent(LoadingComponent, propsData, container, mergedSlots)
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
hide: instance!.exposed!.hide
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
import { createComponent } from './helpers'
|
|
2
|
+
import LoadingComponent from './Component.vue'
|
|
3
|
+
|
|
4
|
+
export const useLoading = (globalProps = {}, globalSlots = {}) => {
|
|
5
|
+
return {
|
|
6
|
+
show(props = globalProps, slots = globalSlots) {
|
|
7
|
+
const forceProps = {
|
|
8
|
+
programmatic: true,
|
|
9
|
+
lockScroll: true,
|
|
10
|
+
isFullPage: false,
|
|
11
|
+
active: true
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const propsData = { ...globalProps, ...props, ...forceProps }
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
let container = propsData.container
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
if (!propsData.container) {
|
|
19
|
+
container = document.body
|
|
20
|
+
propsData.isFullPage = true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const mergedSlots = { ...globalSlots, ...slots }
|
|
24
|
+
const instance = createComponent(LoadingComponent, propsData, container, mergedSlots)
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
hide: instance!.exposed!.hide
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { h, render } from 'vue'
|
|
2
|
-
|
|
3
|
-
export const removeElement = (el: HTMLElement) => {
|
|
4
|
-
if (typeof el.remove !== 'undefined') {
|
|
5
|
-
el.remove()
|
|
6
|
-
} else {
|
|
7
|
-
el.parentNode?.removeChild(el)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Taken from https://github.com/moyoujun/vue3-loading-overlay/blob/master/src/index.ts
|
|
12
|
-
export function createComponent(
|
|
13
|
-
component: any,
|
|
14
|
-
props: any,
|
|
15
|
-
parentContainer: HTMLElement,
|
|
16
|
-
slots = {}
|
|
17
|
-
) {
|
|
18
|
-
const vNode = h(component, props, slots)
|
|
19
|
-
const container = document.createElement('div')
|
|
20
|
-
container.classList.add('vld-container')
|
|
21
|
-
parentContainer.appendChild(container)
|
|
22
|
-
render(vNode, container)
|
|
23
|
-
|
|
24
|
-
return vNode.component
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const hasWindow = () => {
|
|
28
|
-
return typeof window !== 'undefined'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const MayBeHTMLElement = hasWindow() ? window.HTMLElement : Object
|
|
1
|
+
import { h, render } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const removeElement = (el: HTMLElement) => {
|
|
4
|
+
if (typeof el.remove !== 'undefined') {
|
|
5
|
+
el.remove()
|
|
6
|
+
} else {
|
|
7
|
+
el.parentNode?.removeChild(el)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Taken from https://github.com/moyoujun/vue3-loading-overlay/blob/master/src/index.ts
|
|
12
|
+
export function createComponent(
|
|
13
|
+
component: any,
|
|
14
|
+
props: any,
|
|
15
|
+
parentContainer: HTMLElement,
|
|
16
|
+
slots = {}
|
|
17
|
+
) {
|
|
18
|
+
const vNode = h(component, props, slots)
|
|
19
|
+
const container = document.createElement('div')
|
|
20
|
+
container.classList.add('vld-container')
|
|
21
|
+
parentContainer.appendChild(container)
|
|
22
|
+
render(vNode, container)
|
|
23
|
+
|
|
24
|
+
return vNode.component
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const hasWindow = () => {
|
|
28
|
+
return typeof window !== 'undefined'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const MayBeHTMLElement = hasWindow() ? window.HTMLElement : Object
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useLoading } from './api'
|
|
2
|
-
import Component from './Component.vue'
|
|
3
|
-
import type { App } from 'vue'
|
|
4
|
-
|
|
5
|
-
const LoadingPlugin = (app: App, props = {}, slots = {}) => {
|
|
6
|
-
const instance = useLoading(props, slots)
|
|
7
|
-
// app.config.globalProperties.$loading = instance
|
|
8
|
-
app.provide('$loading', instance)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default Component
|
|
12
|
-
export { useLoading, LoadingPlugin, Component }
|
|
1
|
+
import { useLoading } from './api'
|
|
2
|
+
import Component from './Component.vue'
|
|
3
|
+
import type { App } from 'vue'
|
|
4
|
+
|
|
5
|
+
const LoadingPlugin = (app: App, props = {}, slots = {}) => {
|
|
6
|
+
const instance = useLoading(props, slots)
|
|
7
|
+
// app.config.globalProperties.$loading = instance
|
|
8
|
+
app.provide('$loading', instance)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default Component
|
|
12
|
+
export { useLoading, LoadingPlugin, Component }
|