Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #503, setPage实现跳转页面 #581

Merged
merged 6 commits into from
Mar 19, 2024

Conversation

Little-LittleProgrammer
Copy link
Contributor

修复 #503 问题;

  • 6033c9e: 增加 page-change 回调, 以触发页面跳转
  • f8213ad: 增加报错兜底
    runtime/vue3/playground/App.vue
    runtime/vue2/playground/App.vue
    packages/core/src/App.ts

@@ -204,7 +204,7 @@ class App extends EventEmitter implements AppCore {
this.page = undefined;
}

super.emit('page-change');
super.emit('page-change', id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

页面不存在就不应该还触发page-change

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

即使要触发,也应该是用undefined而不是id

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更改😀

}
const newUrl = url.toString();
if (needReload) {
window.location.href = newUrl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用global

if (needReload) {
window.location.href = newUrl;
} else {
window.history.pushState({ path: url.href }, '', url.href);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

设置state key 叫 path,为什么值是href?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是不需要state global.history.pushState({ }, '', url); 这样就可以了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯, 是的, 我改一下

if (needReload) {
window.location.href = newUrl;
} else {
window.history.pushState({ path: url.href }, '', url.href);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是不需要state global.history.pushState({ }, '', url); 这样就可以了

@jia000 jia000 merged commit 0c746aa into Tencent:master Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants