Commit a4a13efa4afaab1b25b4828d30d71bcd7d2e9b7e

Authored by YunaiV
1 parent 0f75f63c

基于 screw 实现一个 mvp 的数据库文档功能

ruoyi-ui/src/api/infra/dbDoc.js 0 → 100644
  1 +// 导出参数
  2 +import request from "@/utils/request";
  3 +
  4 +export function exportHtml() {
  5 + return request({
  6 + url: '/infra/db-doc/export-html',
  7 + method: 'get',
  8 + responseType: 'blob'
  9 + })
  10 +}
ruoyi-ui/src/views/tool/dbDoc/index.vue 0 → 100644
  1 +<template>
  2 + <div v-loading="loading" :style="'height:'+ height">
  3 + <iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" />
  4 + </div>
  5 +</template>
  6 +<script>
  7 +import {exportHtml} from "@/api/infra/dbDoc";
  8 +
  9 +export default {
  10 + name: "DBDoc",
  11 + data() {
  12 + return {
  13 + height: document.documentElement.clientHeight - 94.5 + "px;",
  14 + loading: true,
  15 + src: undefined,
  16 + };
  17 + },
  18 + mounted: function() {
  19 + setTimeout(() => {
  20 + this.loading = false;
  21 + }, 230);
  22 + const that = this;
  23 + window.onresize = function temp() {
  24 + that.height = document.documentElement.clientHeight - 94.5 + "px;";
  25 + };
  26 + },
  27 + created() {
  28 + exportHtml().then(response => {
  29 + // var blob = new Blob(['<a id="a"><b id="b">hey!</b></a>'], {type : 'text/html'});
  30 + this.src = window.URL.createObjectURL(response);
  31 + })
  32 + },
  33 +};
  34 +</script>