2021-03-17 11:29:01 +00:00
|
|
|
<script>
|
|
|
|
import LiveEditor from './views/liveeditor/LiveEditor';
|
|
|
|
import { services, data } from './views/liveeditor/LiveEditorData';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'appdoc',
|
|
|
|
props: {
|
|
|
|
name: null,
|
|
|
|
sources: null,
|
|
|
|
service: null,
|
|
|
|
data: null,
|
|
|
|
dependencies: null,
|
2021-03-25 09:04:37 +00:00
|
|
|
extPages: null,
|
|
|
|
extFiles: null
|
2021-03-17 11:29:01 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
renderPanels() {
|
|
|
|
let tabs = [];
|
|
|
|
|
|
|
|
if (this.$slots.default) {
|
|
|
|
tabs.push(<TabPanel header="Documentation">{this.$slots.default()}</TabPanel>);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.sources) {
|
|
|
|
const sourceType = this.$appState.sourceType; //options-api or composition-api
|
|
|
|
/* eslint-disable */
|
|
|
|
tabs.push(
|
|
|
|
<TabPanel header={this.sources[sourceType].tabName}>
|
2021-03-25 09:04:37 +00:00
|
|
|
<LiveEditor name={this.name} sources={this.sources} service={this.service} data={this.data} dependencies={this.dependencies} extPages={this.extPages} extFiles={this.extFiles}/>
|
2021-03-17 11:29:01 +00:00
|
|
|
<pre v-code><code>
|
|
|
|
{this.sources[sourceType].content.replace('<\\/script>', '<\/script>')}
|
|
|
|
</code></pre>
|
|
|
|
</TabPanel>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.extPages) {
|
|
|
|
/* eslint-disable */
|
|
|
|
this.extPages.forEach(file => {
|
|
|
|
tabs.push(
|
|
|
|
<TabPanel key={file.tabName} header={file.tabName}>
|
|
|
|
<pre v-code><code>
|
|
|
|
{file.content.replace('<\\/script>', '<\/script>')}
|
|
|
|
</code></pre>
|
|
|
|
</TabPanel>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.service) {
|
2021-03-23 10:47:50 +00:00
|
|
|
let serviceArr = [];
|
|
|
|
|
|
|
|
this.service.forEach(el => {
|
|
|
|
serviceArr.push(el.split(','))
|
|
|
|
})
|
2021-03-17 11:29:01 +00:00
|
|
|
/* eslint-disable */
|
2021-03-23 10:47:50 +00:00
|
|
|
serviceArr.forEach((el, i) => {
|
|
|
|
tabs.push(
|
|
|
|
<TabPanel key="service" header={`${el}.js`}>
|
|
|
|
<pre v-code="script"><code>
|
|
|
|
{services[el]}
|
|
|
|
</code></pre>
|
|
|
|
</TabPanel>
|
|
|
|
);
|
|
|
|
})
|
2021-03-17 11:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.data) {
|
2021-03-22 14:08:02 +00:00
|
|
|
let dataArr = [];
|
|
|
|
|
|
|
|
this.data.forEach(el => {
|
|
|
|
dataArr.push(el.split(','))
|
|
|
|
})
|
|
|
|
|
2021-03-17 11:29:01 +00:00
|
|
|
dataArr.forEach((el, i) => {
|
|
|
|
tabs.push(
|
|
|
|
<TabPanel key={`${el}_i`} header={`${el}.json`}>
|
|
|
|
<pre v-code="script" style={{maxHeight: '500px'}}><code>
|
|
|
|
{data[el]}
|
|
|
|
</code></pre>
|
|
|
|
</TabPanel>
|
|
|
|
)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return tabs;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div class="content-section documentation">
|
|
|
|
<TabView>
|
|
|
|
{
|
|
|
|
this.renderPanels()
|
|
|
|
}
|
|
|
|
</TabView>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|