49 lines
964 B
Vue
49 lines
964 B
Vue
<template>
|
|
<div class="container">
|
|
<div class="site-log">
|
|
<MarkdownViewer :markdownContent="markdownText" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { ref, onMounted } from 'vue';
|
|
import MarkdownViewer from '../components/mdRenderer.vue';
|
|
|
|
export default {
|
|
components: {
|
|
MarkdownViewer
|
|
},
|
|
setup() {
|
|
const markdownText = ref('');
|
|
|
|
// 加载 Markdown 文件
|
|
const loadMarkdown = async () => {
|
|
try {
|
|
const response = await fetch('log.md'); // 确保路径正确
|
|
if (response.ok) {
|
|
markdownText.value = await response.text();
|
|
} else {
|
|
console.error('Failed to load markdown file');
|
|
}
|
|
} catch (error) {
|
|
console.error('Error loading markdown file', error);
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
loadMarkdown(); // 页面加载时调用
|
|
});
|
|
|
|
return {
|
|
markdownText
|
|
};
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.site-log {
|
|
padding: 20px;
|
|
}
|
|
</style> |