| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <template>
- <div class="home">
- {{ $route.query.id }}
- <div class="nav">
- <router-link active-class="ha" to="/home/part1" class="hobby">画画</router-link>
- <router-link active-class="ha" to="/home/part2" class="hobby">舞蹈</router-link>
- </div>
-
- <div class="main">
- <!-- keep-alive 组件缓存
- include 控制保留那个组件内容的属性
- -->
- <!-- <keep-alive include="Part1">
- <router-view></router-view>
- </keep-alive> -->
- <!-- 多个存储 -->
- <keep-alive :include="['Part1']">
- <router-view></router-view>
- </keep-alive>
- </div>
- </div>
- </template>
- <script>
- export default {
- created() {
- // 接收query传参
- //$route 路由参数
- console.log(this.$route.query)
- },
- }
- </script>
- <style scoped>
- .home {
- display: flex;
- justify-content: space-between;
- }
- .nav {
- width: 120px;
- height: 400px;
- display: flex;
- margin-top: 20px;
- flex-direction: column;
- /* margin: 30px 0 0 30px; */
- }
- .hobby {
- flex: 1;
- text-align: center;
- line-height: 200px;
- text-decoration: none;
- color: #000;
- border: 1px solid #ff0;
- }
- .main {
- flex: 2;
- /* width: 500px; */
- height: 500px;
- margin-top: 20px;
- margin-left: 30px;
- border: 1px solid purple;
- }
- .ha {
- color: red;
- }
- </style>
|