在使用 vuepress 过程中,出现以下错误
TypeError: Cannot read property 'xxx' of undefined
在使用 vuepress 过程中,有以下文字和格式。
小程序在引用一个不存在的变量 {{ biz.xxx }} ,如果 xxx 不
存在,会在页面显式出现 undefined。
vue编译过程中提示 xxx 不存在,因为 biz 是undefined。
出现这个问题的主要原因是 vuepress 会自动解析 markdown 中的变量(和vue中的用法相同)。
后来查到一种解决办法如下
小程序在引用一个不存在的变量 <code v-pre>{{ biz.xxx }}</code> ,如果 xxx 不
存在,会在页面显式出现 undefined。
将转义的内容放在 `<code v-pre> ... </code>` 中可以解决这个问题。
本文讲述使用 VuePress 时遇到的问题,编译中提示 xxx 不存在,原因是 biz 为 undefined,这是因为 VuePress 会自动解析 Markdown 中的变量。解决办法是将转义内容放在 `<code v-pre>... </code>` 中。
1万+

被折叠的 条评论
为什么被折叠?



