This commit is contained in:
2025-02-25 11:48:26 +08:00
parent 9a289d8c39
commit df971ea418
3 changed files with 11 additions and 9 deletions

View File

@@ -23,7 +23,12 @@ whenever(ctrl_r, () => {})
</script> </script>
<template> <template>
<n-config-provider class="myContainer" :locale="zhCN" :date-locale="dateZhCN" inline-theme-disabled> <n-config-provider
class="myContainer"
:locale="zhCN"
:date-locale="dateZhCN"
inline-theme-disabled
>
<n-split :default-size="1 / 3" min="300px" max="700px"> <n-split :default-size="1 / 3" min="300px" max="700px">
<template #1><Tutorial /></template> <template #1><Tutorial /></template>
<template #2> <template #2>

View File

@@ -12,31 +12,29 @@
</n-button> </n-button>
</n-flex> </n-flex>
</n-flex> </n-flex>
<div class="markdown-body" v-html="markdownContent"></div> <div class="markdown-body" v-html="content"></div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Icon } from "@iconify/vue" import { Icon } from "@iconify/vue"
import { step, prev, next, content } from "../store" import { step, prev, next } from "../store"
import { onMounted, ref, shallowRef, watch } from "vue" import { onMounted, ref, shallowRef, watch } from "vue"
import { marked } from "marked" import { marked } from "marked"
import { markedHighlight } from "marked-highlight" import { markedHighlight } from "marked-highlight"
import hljs from "highlight.js" import hljs from "highlight.js"
const end = ref(false) const end = ref(false)
const markdownContent = shallowRef("") const content = shallowRef("")
async function getContent() { async function getContent() {
const res = await fetch(`/turtorial/${step.value}/README.md`) const res = await fetch(`/turtorial/${step.value}/README.md`)
const data = await res.text() const data = await res.text()
if (!!data) { if (!!data) {
content.value = data const html = await marked.parse(data, { async: true })
const html = await marked.parse(content.value, { async: true }) content.value = html
markdownContent.value = html
end.value = false end.value = false
} else { } else {
end.value = true end.value = true
content.value = ""
} }
} }

View File

@@ -25,7 +25,6 @@ export function changeSize(num: number) {
} }
export const step = useStorage("web-turtorial-step", "01") export const step = useStorage("web-turtorial-step", "01")
export const content = useStorage("web-turtorial-content", "")
export function prev() { export function prev() {
let num = parseInt(step.value) - 1 let num = parseInt(step.value) - 1
step.value = num.toString().padStart(2, "0") step.value = num.toString().padStart(2, "0")