|
@@ -1,13 +1,54 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- 列表
|
|
|
+ <div class="list">
|
|
|
+ <ul>
|
|
|
+ <li v-for="(item, index) in list" :key="index">
|
|
|
+ <RouterLink active-class="active" to="/list/detail">{{
|
|
|
+ item.name
|
|
|
+ }}</RouterLink>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div class="main">
|
|
|
+ <RouterView></RouterView>
|
|
|
</div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <script setup name="List">
|
|
|
- import { ref, reactive} from 'vue'
|
|
|
-
|
|
|
- </script>
|
|
|
- <style lang='scss' scoped>
|
|
|
-
|
|
|
- </style>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="List">
|
|
|
+import { ref, reactive } from "vue";
|
|
|
+import { RouterLink, RouterView } from "vue-router";
|
|
|
+import { nanoid } from "nanoid";
|
|
|
+let list = [
|
|
|
+ { id: nanoid(10), name: "愤怒的小鸟", user: "小艾", password: "123456" },
|
|
|
+ { id: nanoid(10), name: "植物大战僵尸", user: "小赵", password: "999999" },
|
|
|
+ { id: nanoid(10), name: "超级马里奥", user: "小玉", password: "888888" },
|
|
|
+ { id: nanoid(10), name: "黄金矿工", user: "小段", password: "999999" },
|
|
|
+ { id: nanoid(10), name: "森林冰火人", user: "小郑", password: "000000" },
|
|
|
+ { id: nanoid(10), name: "赛尔号", user: "小马", password: "666666" },
|
|
|
+];
|
|
|
+console.log(list, "list");
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+a {
|
|
|
+ text-decoration: none;
|
|
|
+ color: #000;
|
|
|
+}
|
|
|
+.list {
|
|
|
+ display: flex;
|
|
|
+ .main {
|
|
|
+ flex: 1;padding: 15px;
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.active {
|
|
|
+ color: purple !important;
|
|
|
+}
|
|
|
+ul {
|
|
|
+ width: 150px;
|
|
|
+ list-style: none;
|
|
|
+ li {
|
|
|
+ padding: 15px 0;
|
|
|
+ }
|
|
|
+ border-right: 1px solid #000;
|
|
|
+}
|
|
|
+</style>
|