forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.js
More file actions
63 lines (54 loc) · 1.12 KB
/
render.js
File metadata and controls
63 lines (54 loc) · 1.12 KB
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
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
import { h, withDirectives } from 'vue'
export function hSlot (slot, otherwise) {
return slot !== void 0
? slot() || otherwise
: otherwise
}
export function hUniqueSlot (slot, otherwise) {
if (slot !== void 0) {
const vnode = slot()
if (vnode !== void 0 && vnode !== null) {
return vnode.slice()
}
}
return otherwise
}
/**
* Source definitely exists,
* so it's merged with the possible slot
*/
export function hMergeSlot (slot, source) {
return slot !== void 0
? source.concat(slot())
: source
}
/**
* Merge with possible slot,
* even if source might not exist
*/
export function hMergeSlotSafely (slot, source) {
if (slot === void 0) {
return source
}
return source !== void 0
? source.concat(slot())
: slot()
}
/*
* (String) key - unique vnode key
* (Boolean) condition - should change ONLY when adding/removing directive
*/
export function hDir (
tag,
data,
children,
key,
condition,
getDirsFn
) {
data.key = key + condition
const vnode = h(tag, data, children)
return condition === true
? withDirectives(vnode, getDirsFn())
: vnode
}