Skip to content

Commit 1224a4f

Browse files
author
xuhongbin
committed
fix: 更新依赖版本并修复路由历史模式
refactor: 调整App.vue布局和样式 style: 优化Count.vue按钮样式 chore: 移除调试脚本并关闭自动打开浏览器
1 parent a37b82d commit 1224a4f

File tree

7 files changed

+39
-19
lines changed

7 files changed

+39
-19
lines changed

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/vue3-host/emp.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import Vue3 from '@empjs/plugin-vue3'
33
import {externalVue, pluginRspackEmpShare} from '@empjs/share'
44
import pkg from './package.json'
55

6-
const vueVersion = pkg.dependencies.vue
7-
const vueRouterVersion = pkg.dependencies['vue-router']
8-
const piniaVersion = pkg.dependencies.pinia
6+
const vueVersion = pkg.dependencies.vue.replace('^', '')
7+
const vueRouterVersion = pkg.dependencies['vue-router'].replace('^', '')
8+
const piniaVersion = pkg.dependencies.pinia.replace('^', '')
99
export default defineConfig(store => {
1010
return {
1111
defineFix: 'all',
@@ -47,7 +47,7 @@ export default defineConfig(store => {
4747
// name: 'vue3Project',
4848
// }),
4949
],
50-
server: {port: 9901},
50+
server: {port: 9901,open:false},
5151
html: {
5252
title: 'Vue3 Host',
5353
template: 'src/setup/index.html',

projects/vue3-host/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"dependencies": {
1212
"@empjs/share": "workspace:^",
1313
"pinia": "^3.0.3",
14-
"vue": "3.5.21",
15-
"vue-router": "4.5.1"
14+
"vue": "^3.5.21",
15+
"vue-router": "^4.5.1"
1616
},
1717
"scripts": {
1818
"dev": "emp dev",

projects/vue3-host/src/components/App.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
</div>
1010

1111
</div>
12-
<p>
13-
<strong>Current route path:</strong> {{ $route.fullPath }}
14-
</p>
1512
<nav>
16-
<RouterLink to="/">Go to home</RouterLink> |
13+
<RouterLink to="/">Go to home</RouterLink> /
1714
<RouterLink to="/info">Go to info</RouterLink>
1815
</nav>
16+
<p>
17+
<strong>Current route path:</strong> {{ $route.fullPath }}
18+
</p>
1919
<main>
2020
<RouterView />
2121
</main>
@@ -41,7 +41,7 @@ h1 {
4141
}
4242
4343
.logo {
44-
width: 80px;
44+
height: 60px;
4545
}
4646
4747
.header {
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<h3>count: {{ count }}</h3>
3-
<button v-on:click="counterStore.increment">You clicked me {{ count }} times.</button>
2+
<h3>count: <b>{{ count }}</b></h3>
3+
<button class="button" v-on:click="counterStore.increment">Clicked Me</button>
44
</template>
55

66
<script setup lang="ts">
@@ -9,4 +9,23 @@ import { useCounterStore } from './countStore'
99
1010
const counterStore = useCounterStore()
1111
const { count } = storeToRefs(counterStore)
12-
</script>
12+
</script>
13+
14+
<style lang="css" scoped>
15+
h3 b {
16+
font-size: 36px;
17+
}
18+
19+
.button {
20+
background-color: #04AA6D;
21+
/* Green */
22+
border: none;
23+
color: white;
24+
padding: 8px 20px;
25+
text-align: center;
26+
text-decoration: none;
27+
display: inline-block;
28+
font-size: 14px;
29+
border-radius: 8px;
30+
}
31+
</style>

projects/vue3-host/src/setup/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<title></title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<script src="https://yo-debug-test.yy.com/target.js"></script>
7+
<!-- <script src="https://yo-debug-test.yy.com/target.js"></script> -->
88
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script> -->
99
<!-- <script>eruda.init();</script> -->
1010
</head>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import {createRouter, createWebHashHistory} from 'vue-router'
1+
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
22

33
const routes = [
44
{path: '/', name: 'home', component: () => import('src/components/Home.vue')},
55
{path: '/info', name: 'info', component: () => import('src/components/Info.vue')},
66
]
77

88
export const router = createRouter({
9-
history: createWebHashHistory(),
9+
// history: createWebHashHistory(),
10+
history: createWebHistory(),
1011
routes,
1112
})

0 commit comments

Comments
 (0)