Skip to content

Commit 310b4c4

Browse files
committed
7.羊了个羊
1 parent 8e0390d commit 310b4c4

File tree

2 files changed

+584
-0
lines changed

2 files changed

+584
-0
lines changed

Vue3/vue3js/playground.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>provide</title>
9+
<script src="https://unpkg.com/vue@next"></script>
10+
</head>
11+
12+
<body>
13+
<div id="Application">
14+
一、简单插槽
15+
<componenta>喜羊羊</componenta>
16+
二、注入插槽
17+
<componentb>
18+
<template v-slot:header>
19+
header
20+
</template>
21+
<template #body>
22+
body
23+
24+
</template>
25+
<template #foot>
26+
foot
27+
28+
</template>
29+
</componentb>
30+
</div>
31+
<script>
32+
const App = Vue.createApp({})
33+
App.component("componenta", {
34+
template: `
35+
<div>
36+
这是组件
37+
<slot></slot>
38+
</div>
39+
`
40+
})
41+
App.component("componentb", {
42+
template: `
43+
<div>
44+
注入插槽
45+
<slot name='header'></slot>
46+
<slot name='body'></slot>
47+
<slot name='foot'></slot>
48+
</div>
49+
`
50+
})
51+
52+
App.mount("#Application")
53+
</script>
54+
</body>
55+
56+
</html>

0 commit comments

Comments
 (0)