Asset Handling
本文档参考官方文档
Public Files
在docs目录下的public文件夹,会被copy到dist的根目录
引用public里的资源时,直接使用/资源名
就行了
Base URL
引用静态资源时,可以在markdown中使用相对路径。
类似这种情况时:
html
<img :src="theme.logoPath" />
1
最好用withBase包裹
vue
<script setup>
import { withBase, useData } from 'vitepress'
const { theme } = useData()
</script>
<template>
<img :src="withBase(theme.logoPath)" />
</template>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9