Commit c66a110dddb9845fd7674cbb3b87d79214e6dfe5

Authored by 王家文
1 parent 2b11cec2
Exists in master

【工具】GM工具

src/App.vue
  1 +
1 2 <template>
2   - <ToolTitle msg="Hello Vue 3.0 + Vite" />
3   - <HelloWorld msg="Hello Vue 3.0 + Vite" />
4   -</template>
  3 + <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
  4 + <!-- Brand -->
  5 + <a class="navbar-brand" href="#">梦幻合合合</a>
  6 +
  7 + <!-- Links -->
  8 + <ul class="navbar-nav">
  9 + <!-- Dropdown -->
  10 + <li class="nav-item dropdown">
  11 + <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-bs-toggle="dropdown">
  12 + 服务器选择
  13 + </a>
  14 + <div class="dropdown-menu">
  15 + <a class="dropdown-item" href="#">Link 1</a>
  16 + <a class="dropdown-item" href="#">Link 2</a>
  17 + <a class="dropdown-item" href="#">Link 3</a>
  18 + </div>
  19 + </li>
5 20  
6   -<script>
7   -import ToolTitle from './components/ToolTitle.vue'
8   -import HelloWorld from './components/HelloWorld.vue'
  21 + <li class="nav-item">
  22 + <a class="nav-link" href="#">玩家修改</a>
  23 + </li>
  24 + <li class="nav-item">
  25 + <a class="nav-link" href="#">玩家查询</a>
  26 + </li>
  27 +
  28 + </ul>
  29 + </nav>
  30 +
  31 + <component :is="currentView" />
  32 +</template>
9 33  
10   -export default {
11   - name: 'App',
12   - components: {
13   - ToolTitle,
14   - HelloWorld
15   - }
  34 +<script setup>
  35 +import { ref, computed } from 'vue'
  36 +import Home from './components/Home.vue'
  37 +import About from './components/About.vue'
  38 +import NotFound from './components/NotFound.vue'
  39 +const routes = {
  40 + '/': Home,
  41 + '/about': About
16 42 }
  43 +const currentPath = ref(window.location.hash)
  44 +window.addEventListener('hashchange', () => {
  45 + currentPath.value = window.location.hash
  46 +})
  47 +const currentView = computed(() => {
  48 + return routes[currentPath.value.slice(1) || '/'] || NotFound
  49 +})
17 50 </script>
... ...
src/components/About.vue 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<template>
  2 + <h1>About</h1>
  3 +</template>
0 4 \ No newline at end of file
... ...
src/components/Home.vue 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<template>
  2 + <h1>Home</h1>
  3 +</template>
0 4 \ No newline at end of file
... ...
src/components/NotFound.vue 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<template>
  2 + <h1>404</h1>
  3 +</template>
0 4 \ No newline at end of file
... ...