-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
ECodeInline.ts
42 lines (40 loc) 路 871 Bytes
/
ECodeInline.ts
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
import type { CSSProperties, PropType } from 'vue'
import { defineComponent, h } from 'vue'
export default defineComponent({
name: 'ECodeInline',
props: {
class: {
type: String,
default: '',
},
style: {
type: Object as PropType<CSSProperties>,
},
},
setup(props, { slots }) {
return () =>
[h('style', null, `
meta ~ .cino {
display: none !important;
opacity: 0 !important;
}
meta ~ .cio {
display: block !important;
}
`), h('code', {
...props,
class: [
props.class,
'cino',
],
style: props.style,
}, slots.default?.()), h('span', {
...props,
class: [
props.class,
'cio',
],
style: { ...props.style, display: 'none' },
}, slots.default?.())]
},
})