优化router-link组件无初始值的点击事件

master 1.3.4
yutent 2023-12-27 15:50:54 +08:00
parent 137c79fce7
commit fc20ea24d4
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -107,6 +107,7 @@ class RouterLink extends Component {
a {
display: flex;
align-items: center;
gap: var(--router-link-gap, 0);
width: 100%;
height: 100%;
color: inherit;
@ -119,7 +120,6 @@ class RouterLink extends Component {
cursor: not-allowed;
}
`
#href = ''
#navigate() {
@ -144,13 +144,14 @@ class RouterLink extends Component {
? query.replaceAll('?', '')
: object2query(query)
path = path.replace(/^\//, '')
path = '/' + path.replace(/^\/+/, '')
this.to = { path, query }
if (params) {
path += '?' + params
}
return '/' + path
return path
}
activated() {