我尝试用插件寄存器/组件在vuepress中添加组件的自定义目录,但这似乎是不可能的。
我试过
module.exports = {
title: 'Hello VuePress',
description: 'Just playing around',
plugins: [
[
'register-components',
{
componentDir: '../components'
}
]
]
}使用此体系结构(我希望选择"components“目录)

但是它似乎不起作用,因为组件没有被识别

我想我把我的组件写得很好-按钮. my

有人能帮我告诉我去那里的步骤吗?
非常感谢
发布于 2018-08-27 03:14:27
您可以在enhanceApp.js中全局注册组件(应该位于/.vuepress/文件夹中),就像在Vue应用程序中注册组件一样。
enhanceApp.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)
}https://stackoverflow.com/questions/51987732
复制相似问题