我尝试使用插件注册/组件在 vuepress 中添加自定义组件目录,但这似乎不可能。
我尝试过
module.exports = {
title: 'Hello VuePress',
description: 'Just playing around',
plugins: [
[
'register-components',
{
componentDir: '../components'
}
]
]
}
使用这种架构(我想选择“组件”目录)
但它似乎不起作用,因为该组件未被识别
我认为我在 base-button.md 中写得很好
有人可以帮助我告诉我到达那里的步骤吗?
多谢
您可以在全局注册组件enhanceApp.js
(它应该位于/.vuepress/
文件夹),就像在 Vue 应用程序中注册它们一样。
增强App.js
import BaseButton from '../../components/BaseButton'
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
Vue.component('BaseButton', BaseButton)
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)