feat: 优化接口配置设计,注册的网络请求会自动注册到 vue 原型 $api 上,修改了一些旧的接口调用方式

This commit is contained in:
FairyEver
2020-05-07 15:49:28 +08:00
parent 804f66eb05
commit 28acfdbb04
21 changed files with 118 additions and 103 deletions

View File

@@ -12,7 +12,6 @@ import marked from 'marked'
import highlight from 'highlight.js'
import bandupan from './plugin/baidupan'
import 'github-markdown-css'
import { componentsMarkdownBase } from '@api/components.markdown'
export default {
name: 'd2-markdown',
props: {
@@ -64,7 +63,7 @@ export default {
},
// 从 url 加载原始数据
async getReadme (url) {
const data = await componentsMarkdownBase(url)
const data = await this.$api.COMPONENT_MARKDOWN_GET({ url })
return this.marked(data)
},
marked (data) {