优化路由,支持首页带index.html访问; 优化router-link样式

master 1.3.10
yutent 2024-05-15 15:31:17 +08:00
parent d3a00a319f
commit a9ff9f0323
3 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wkitd",
"version": "1.3.9",
"version": "1.3.10",
"type": "module",
"main": "dist/index.js",
"files": [

View File

@ -107,6 +107,7 @@ class RouterLink extends Component {
a {
display: flex;
align-items: center;
justify-content: center;
gap: var(--router-link-gap, 0);
width: 100%;
height: 100%;

View File

@ -106,6 +106,10 @@ class Router {
;[path, query] = path.split('?')
}
path = path.replace(PREFIX_REGEXP, '/')
// 修正默认主页,以支持带路径访问的首页
if (path === '/index.html') {
path = '/'
}
if (!$view || path === this.#route.path) {
// query不同, 只更新query