update 一系列功能
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
16
Web/src/pages/system/doc/highlight.js
Normal file
16
Web/src/pages/system/doc/highlight.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export default {
|
||||
props: {
|
||||
code: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
const props = {
|
||||
...this.$props,
|
||||
...this.$attrs
|
||||
}
|
||||
|
||||
return props.code && <highlightjs {...{ props }} />
|
||||
}
|
||||
}
|
||||
53
Web/src/pages/system/doc/index.vue
Normal file
53
Web/src/pages/system/doc/index.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<container>
|
||||
<template v-for="(doc, index) in docs">
|
||||
<component :codes="codes" :is="doc.component" :key="index" />
|
||||
</template>
|
||||
<a-anchor>
|
||||
<a-anchor-link href="#components-anchor-demo-basic" title="Basic demo" />
|
||||
<a-anchor-link href="#components-anchor-demo-static" title="Static demo" />
|
||||
<a-anchor-link
|
||||
href="#components-anchor-demo-basic"
|
||||
target="_blank"
|
||||
title="Basic demo with Target"
|
||||
/>
|
||||
<a-anchor-link href="#API" title="API">
|
||||
<a-anchor-link href="#Anchor-Props" title="Anchor Props" />
|
||||
<a-anchor-link href="#Link-Props" title="Link Props" />
|
||||
</a-anchor-link>
|
||||
</a-anchor>
|
||||
</container>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
docs: [
|
||||
{
|
||||
title: '开始使用',
|
||||
name: 'use',
|
||||
},
|
||||
],
|
||||
codes: {},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.docs.forEach((doc) => {
|
||||
this.$set(doc, 'component', () => import(`./${doc.name}`));
|
||||
});
|
||||
|
||||
const files = require.context('@/../public/doc-part', true, /\.(js|html|vue|css|less)(\?.*)?$/);
|
||||
const codes = {};
|
||||
files.keys().forEach((p) => {
|
||||
const fileName = p.slice(1);
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', `./doc-part${fileName}`, false);
|
||||
xhr.overrideMimeType('text/plain;charset=utf-8');
|
||||
xhr.send(null);
|
||||
codes[fileName] = xhr.responseText;
|
||||
});
|
||||
console.log(codes);
|
||||
this.codes = codes;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
21
Web/src/pages/system/doc/use.vue
Normal file
21
Web/src/pages/system/doc/use.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<section>
|
||||
<h3>开始使用</h3>
|
||||
<Highlight :code="codes['/use/a.js'] || ''" language="javascript" />
|
||||
<Highlight :code="codes['/use/test.vue'] || ''" language="javascript" />
|
||||
</section>
|
||||
</template>
|
||||
<script>
|
||||
import Highlight from './highlight';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Highlight,
|
||||
},
|
||||
props: {
|
||||
codes: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -260,6 +260,9 @@ export default {
|
||||
} else {
|
||||
this.$message.error(message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
record.statusChanging = false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user