-
Notifications
You must be signed in to change notification settings - Fork 0
/
useRender.tsx
91 lines (83 loc) · 1.9 KB
/
useRender.tsx
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { withModifiers } from 'vue';
import { RouterLink, RouterView } from 'vue-router';
import HelloWorld from '@/components/hello_world/HelloWorld';
import BaseInput from '@/components/base_input/BaseInput';
import logo from '@/assets/logo.png';
import DisplayMsgOnce from '@/components/DisplayMsgOnce';
import type { App } from './App';
const boxStyle = {
width: '200px',
margin: 'auto',
padding: '10px',
marginBottom: '10px',
}
export default function useRender(c: App) {
return (
<>
<img alt="Vue logo" src={logo} />
<div
style={{
...boxStyle,
border: '1px solid black',
}}
>
{ /* TS not happy to mix SFC and TSX components*/}
<with-template msg="Prop message" />
</div>
<div
style={{
...boxStyle,
border: '1px solid blue',
}}
>
<HelloWorld
class="a-class-name"
msg="Vue 3.0"
onCustomClick={console.log}
vSlots={{
default: () => 'slot render',
}}
/>
</div>
<div
style={{
...boxStyle,
border: '1px solid green',
}}
>
<button
type="button"
onClick={withModifiers(() => {
console.log('button clicked');
}, ['stop'])}
>
{' '}
Catch native event
</button>
</div>
<div
style={{
...boxStyle,
border: '1px solid pink',
}}
>
<BaseInput v-model={c.v} />
{' '}
<DisplayMsgOnce msg={c.v} />
</div>
<RouterView />
<RouterLink
to={{ name: 'test' }}
vSlots={{
default: ({ navigate, href }) => (
<a
href={href}
onClick={navigate}
v-text="A Router Link"
/>
),
}}
/>
</>
);
}