Commit a821ffc9 by 初志鑫

更新markdown演示组件调用方式

parent 8f3c48d8
import request from "axios";
export function getList() {
return request({
url: "https://cdn.jsdelivr.net/gh/prettier/prettier@master/docs/options.md",
method: "get",
});
}
......@@ -16,8 +16,7 @@
<script>
import marked from "marked";
import "github-markdown-css/github-markdown.css";
import md from "./js/markdown";
import { getList } from "@/api/markdown";
export default {
name: "Markdown",
data() {
......@@ -43,11 +42,12 @@ export default {
this.value = val;
this.fetchData();
},
fetchData() {
async fetchData() {
this.listLoading = true;
switch (this.value) {
case "0":
this.prettierList = marked(md || "", {
const { data } = await getList();
this.prettierList = marked(data || "", {
renderer: new marked.Renderer(),
gfm: true,
tables: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment