Closed GlenHeart closed 3 years ago
其实我就是想在页面加个element-ui
const VitePressApp = { name: 'VitePressApp', setup() { if (import.meta.env.PROD) { // in prod mode, enable intersectionObserver based pre-fetch usePrefetch(); } return () => h(Theme.Layout); } }; 感觉这里可以加个提示
importMap: { ElementPlus: 'https://cdn.jsdelivr.net/npm/element-plus@1.1.0-beta.20/dist/index.full.min.js', } 使用这种方式报props类型需要个string
runtime-core.esm-bundler.js:6568 [Vue warn]: Invalid prop: type check failed for prop "importMap". Expected Object, got String with value "%7B%22ElementPlus%22%3A%22https%3A%2F%2Fcdn.jsdelivr.net%2Fnpm%2Felement-plus%401.1.0-beta.20%2Fdist%2Findex.full.min.js%22%7D".
at <Demo src="./demo/demo.vue" language="vue" title="基本用法" ... >
at
// theme/index.js
import DefaultTheme from 'vitepress-for-component/dist/client/theme-default';
export default { ...DefaultTheme,
enhanceApp({ app, router, siteData }) {
// app is the Vue 3 app instance from createApp()
. router is VitePress'
// custom router. siteData`` is a
ref`` of current site-level metadata.
},
};
2. 提示“props类型需要个string” 这个是bug,我处理下
3. 其实可以直接`import {x} from 'element-plus'` 使用吧,不用在主题引入?
Describe the bug .vitepress/theme/index.js 添加enhanceApp 报错
To Reproduce Steps to reproduce the behavior: .vitepress/theme/index.js 创建文件 添加代码如下:
Expected behavior A clear and concise description of what you expected to happen. 期望是正常的,但是页面是报错了,runtime-core.esm-bundler.js:6568 [Vue warn]: Invalid vnode type when creating vnode: undefined. at
System Info
Additional context Add any other context about the problem here.