|
|
@@ -1,13 +1,69 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <h1>Vue3组件通信</h1>
|
|
|
+ <div class="text-xl">
|
|
|
+ <h1
|
|
|
+ class="text-5xl font-bold text-purple-600 text-center h-32 leading-[128px]"
|
|
|
+ >
|
|
|
+ Vue3组件通信
|
|
|
+ </h1>
|
|
|
<hr />
|
|
|
- <div class="main">
|
|
|
- <div class="nav">
|
|
|
- <RouterLink to="/props">1.props</RouterLink>
|
|
|
- <RouterLink to="/custom">2.custom</RouterLink>
|
|
|
+ <div class="flex p-6">
|
|
|
+ <div class="w-64 flex flex-col">
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/props"
|
|
|
+ >1.props</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/custom"
|
|
|
+ >2.custom</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/mitt"
|
|
|
+ >3. mitt</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/refs"
|
|
|
+ >4.refs-parent</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/attrs"
|
|
|
+ >5. $attrs</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/provide"
|
|
|
+ >6. provide-inject</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/slot1"
|
|
|
+ >7. 默认插槽</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/slot2"
|
|
|
+ >8. 具名插槽</RouterLink
|
|
|
+ >
|
|
|
+ <RouterLink
|
|
|
+ active-class="active"
|
|
|
+ class="border h-12 flex justify-center items-center"
|
|
|
+ to="/slot3"
|
|
|
+ >9. 作用域插槽</RouterLink
|
|
|
+ >
|
|
|
</div>
|
|
|
- <div class="content">
|
|
|
+ <div class="flex-1 ml-8">
|
|
|
<RouterView></RouterView>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -19,22 +75,8 @@ import { ref, reactive } from "vue";
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-h1 {
|
|
|
- text-align: center;
|
|
|
- color: plum;
|
|
|
-}
|
|
|
-.main {
|
|
|
- display: flex;
|
|
|
- .nav {
|
|
|
- width: 260px;
|
|
|
- height: 300px;
|
|
|
- background: #f00;
|
|
|
- }
|
|
|
- .content {
|
|
|
- flex: 1;
|
|
|
- margin-left: 30px;
|
|
|
- height: 600px;
|
|
|
- background: #ff0;
|
|
|
- }
|
|
|
+.active {
|
|
|
+ background: plum;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
</style>
|