如何将vuetify添加到默认vuepress主题

问题描述:

是否可以将vuetify添加到默认的vuepress主题?

Is it possible to add vuetify to default vuepress theme ?

我只需要在默认主题中添加一些组件,但是最好使用vuetify处理组件中的表单.

I just need to add few components to default theme however it would be nice to use the vuetify for handling forms within my components.

我找到了使用vuetify的自定义vuepress主题,但是我更喜欢使用默认的vuepress主题.

I have found a custom vuepress theme which uses a vuetify, however I would prefer to use default vuepress theme.

另一个选择是弹出默认主题并将其添加到其中.但是我宁愿不弹出默认主题,而只是向其添加vuetify.

Another option is to eject the default theme and add the vuetify to it. However I would prefer not to eject the default theme just add vuetify to it.

上一个答案 https://stackoverflow.com/users/3714327/oscarteg">oscarteg 吸引了我大部分的注意力.这是我对.vuepress/enhanceApp.js文件所要做的(是的,如果您没有人继续创建它的话).

The previous answer from oscarteg got me most of the way there. Here's what I had to do for the .vuepress/enhanceApp.js file (and yes, if you do not have one go ahead and create it).

import Vuetify from "vuetify";
import "vuetify/dist/vuetify.min.css";
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.use(Vuetify);
  options.vuetify = new Vuetify({})
};

请注意,在传递给options.vuetifynew Vuetify({})中,您可以设置主题.

Note that in the new Vuetify({}) passed to options.vuetify you can set your theming.

请参见 https://github.com/vuejs/vuepress/issues/681 #issuecomment-515704018