wangting
2024-05-14 51636e9cd814bddba7a9b4ff21b5bc94e95fb6cb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
  <div class="md-content">
    <mark-down-it-vue class="md-body" :content="htmlMD"></mark-down-it-vue>
  </div>
</template>
 
<script>
import MarkDownItVue from "markdown-it-vue"
import "markdown-it-vue/dist/markdown-it-vue.css"
import {verifyNull} from "@/util/validate";
 
export default {
  name: "readMD",
  components: {MarkDownItVue},
  data() {
    return {
      htmlMD: "",
      type:''
    }
  },
  created() {
    if (verifyNull(this.$route.query.type)) {
      this.$message.error("配置的信息错误,请配置type参数");
      return false;
    }
    this.type=this.$route.query.type;
    axios.get(`./src/configDoc/${this.type}.md`).then((response) => {
      this.htmlMD = response.data;
    });
    /*require(`@/configDoc/${this.type}.md`).then((markdown) => {
      debugger;
      this.htmlMD = markdown;
    }).catch((error) => {
      console.log('配置文档读取失败:', error);
    });*/
  }
}
</script>
 
<style scoped>
 
</style>