vuepress-reco / vuepress-theme-reco

🎨 This is the repo for vuepress-theme-reco 2.
https://vuepress-theme-reco.recoluan.com
MIT License
538 stars 173 forks source link

使用 theme-cli生成的2.x无法立即使用 #257

Closed threeTrave closed 6 months ago

threeTrave commented 7 months ago

Bug report

2。使用主题cli生成的2.x无法立即使用,并且无法显示初始页面。控制台报告错误: image 错误指向此文件 image 第三十行代码 :const localePaths = Object.keys(locales).sort((a, b) => ... 我怀疑locales配置项未被确定为未定义。在检查原始config.ts文件时,确实没有定义与本地相关的设置。 解决方法一: 在config中设置locales配置项后之后,bug就会消失。(示例下面的评论已经给出) 解决方法二: 在报错的文件中对local是否为undefine进行判空,bug就会消失。如下所示: image

What is actually happening?

Other relevant information

HSqure commented 7 months ago

It worked! Thanks!

minibear2333 commented 7 months ago
image

在主题配置里添加以下内容即可

locales: {
      // 键名是该语言所属的子路径
      // 作为特例,默认语言可以使用 '/' 作为其路径。
      '/': {
        lang: 'zh-CN',
        title: 'VuePress',
        description: 'Vue 驱动的静态网站生成器',
      },
    },
zhooke commented 6 months ago

感谢,有用,不知道为啥不改呢

Guocccw commented 6 months ago

It worked! 不过这个bug很难搞吗?怎么离谱的问题都不改