Browse Source

增加list路由

caner 1 year ago
parent
commit
41c1e5f5c7
3 changed files with 23 additions and 4 deletions
  1. 7 4
      src/pages/room/index.vue
  2. 11 0
      src/pages/room/list.vue
  3. 5 0
      src/pages/room/route.ts

+ 7 - 4
src/pages/room/index.vue

@@ -10,7 +10,7 @@
       >
         <div
           class="room-content-item"
-          @click="itemClick"
+          @click="change('/list')"
         >
           <div>
             <p>客厅</p>
@@ -27,7 +27,10 @@
     </div>
     <div class="room-bar">
       <span>创建你的房间</span>
-      <n-button type="warning">
+      <n-button
+        type="warning"
+        @click="change('/create')"
+      >
         创建
       </n-button>
     </div>
@@ -49,9 +52,9 @@ const roomList = ref([
   { 1: 1 }
 ])
 
-function itemClick() {
+function change(url:string) {
   console.log('跳转到设备list')
-  router.push('/create')
+  router.push(url)
 }
 </script>
 <style lang="scss" scoped>

+ 11 - 0
src/pages/room/list.vue

@@ -0,0 +1,11 @@
+<template>
+  <div>设备列表</div>
+</template>
+
+<script setup lang='ts'>
+
+</script>
+
+<style>
+
+</style>

+ 5 - 0
src/pages/room/route.ts

@@ -18,6 +18,11 @@ export default {
       path: '/create',
       name: 'create',
       component: () => import('./create.vue')
+    },
+    {
+      path: '/list',
+      name: 'list',
+      component: () => import('./list.vue')
     }
   ]
 } as RouteRecordRaw