自动添加标题
This commit is contained in:
@@ -120,7 +120,8 @@ async function prepare() {
|
|||||||
async function getContent() {
|
async function getContent() {
|
||||||
const data = await Tutorial.get(step.value)
|
const data = await Tutorial.get(step.value)
|
||||||
taskId.value = data.task_ptr
|
taskId.value = data.task_ptr
|
||||||
content.value = await marked.parse(data.content, { async: true })
|
const merged = `# #${data.display} ${data.title}\n${data.content}`
|
||||||
|
content.value = await marked.parse(merged, { async: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用 js 来写的,可以换成 vue 的方式
|
// 用 js 来写的,可以换成 vue 的方式
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { ref } from "vue"
|
import { ref } from "vue"
|
||||||
import { TASK_TYPE } from "../utils/const"
|
import { TASK_TYPE } from "../utils/const"
|
||||||
|
|
||||||
export const taskTab = ref(TASK_TYPE.Tutorial)
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
|
const currentTask = urlParams.get("task") ?? TASK_TYPE.Tutorial
|
||||||
|
|
||||||
|
export const taskTab = ref(currentTask)
|
||||||
export const taskId = ref(0)
|
export const taskId = ref(0)
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { ref } from "vue"
|
import { ref } from "vue"
|
||||||
|
|
||||||
export const step = ref(1)
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
|
const currentStep = urlParams.get("step") ?? "1"
|
||||||
|
|
||||||
|
export const step = ref(Number(currentStep))
|
||||||
|
|
||||||
export const show = ref(true)
|
export const show = ref(true)
|
||||||
export const tutorialSize = ref(2 / 5)
|
export const tutorialSize = ref(2 / 5)
|
||||||
|
|||||||
Reference in New Issue
Block a user