-
-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Checklist
- I am using LTS version of Node.js.
- I am using the latest v2 version of VuePress and VuePress official plugins.
- I am using the latest version of vuepress-theme-plume and all plugins in this repo.
- I followed the docs and I double checked my configuration.
Package name
vuepress-theme-plume
Which operating system are you using?
- macOS
- Windows
- Linux
Describe the bug
Issue Title
<VPHomeBox> 组件,遇到不存在的 hero.action.link 时抛出 useDarkMode() provider 错误
Bug 描述
在使用 VPHomeBox 组件时,如果 hero.actions 中存在指向项目内不存在页面的 link(例如 /update-log/ 不存在),页面会报错并中断渲染:
Error: useDarkMode() is called without provider.
at useDarkMode (index.js?v=e12ca24c:93:25)
at setup (VPHomeBox.vue?v=e12ca24c:19:20)
at callWithErrorHandling (…)
当我隐藏或移除 VPHomeBox 组件后,错误消失。
Additional context
复现步骤
- 在项目的
readme.md(frontmatter)中加入如下配置(注意第二个链接在项目中不存在):
---
pageLayout: home
externalLinkIcon: false
config:
- type: hero
full: true
background: tint-plate
hero:
name: test
tagline: test
text: test
actions:
- theme: brand
text: test111
link: https://www.baidu.com
- theme: alt
text: 更新日志 →
link: /update-log/ # 在我的项目中不存在该路径,会触发错误
---- 启动项目并打开包含
<VPHomeBox>组件的页面。 - 刷新页面后,控制台报错(如上)。
实际行为
抛出 useDarkMode() is called without provider.,导致页面报错或渲染中断。
期望行为
即便 hero.actions 中包含指向不存在页面的 link,也不应触发全局错误。
yxzlwz
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working