Browse Source

bug修复

iZaiZaiA 2 years ago
parent
commit
b6adef5712

+ 0 - 1
package.json

@@ -29,7 +29,6 @@
         "@vitejs/plugin-vue": "^3.1.0",
         "@vue/compiler-sfc": "^3.2.40",
         "autoprefixer": "^10.4.12",
-        "monaco-editor": "^0.34.0",
         "postcss": "^8.4.16",
         "sass": "^1.55.0",
         "tailwindcss": "^3.1.8",

+ 46 - 0
src/test/http/components/HcCodeEditor.vue

@@ -0,0 +1,46 @@
+<template>
+    <div id="codeEditBox"></div>
+</template>
+
+<script setup>
+import {ref, nextTick, watch, onBeforeUnmount, onMounted} from "vue";
+import {isItem,getArrValue,getObjValue} from "vue-utils-plus"
+
+//参数
+const props = defineProps({
+    val: {
+        type: [String,Number],
+        default: ''
+    },
+    data: {
+        type: Object,
+        default: () => ({})
+    },
+})
+
+//变量
+//let editor;
+const text = ref(props.val,)
+const language = ref('JSON')
+
+//监听
+watch(() => [
+    props.val,
+], ([val]) => {
+    text.value = val
+})
+
+
+onMounted(() => {
+    //editorInit()
+})
+
+
+onBeforeUnmount(()=>{
+    //editor.dispose()
+})
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 18 - 13
src/test/http/index.vue

@@ -61,7 +61,7 @@
                             <el-table-column prop="action" label="操作" width="280" align="center">
                                 <template #default="scope">
                                     <el-button type="primary" plain size="small">
-                                        <HcIcon name="add-circle"/>
+                                        <HcIcon name="add-box"/>
                                         <span>添加同级</span>
                                     </el-button>
                                     <el-button type="primary" plain size="small">
@@ -78,20 +78,20 @@
                     </div>
                 </div>
                 <div class="http-form-res">
-                    <div class="title-box">返回数据</div>
-                    res
+                    <div class="title-box">
+                        <div class="title">返回数据</div>
+                        <div class="extra">
+                            <el-button type="primary" hc-btn>
+                                <HcIcon name="database"/>
+                                <span>查看整体JSON数据</span>
+                            </el-button>
+                        </div>
+                    </div>
+                    <div class="http-form-res-box">
+                        <HcCodeEditor :data="httpForm"/>
+                    </div>
                 </div>
             </div>
-            <template #action>
-                <el-button type="primary" hc-btn>
-                    <HcIcon name="add-circle"/>
-                    <span>新增</span>
-                </el-button>
-                <el-button hc-btn>
-                    <HcIcon name="edit"/>
-                    <span>编辑</span>
-                </el-button>
-            </template>
         </HcCard>
 
     </div>
@@ -101,6 +101,7 @@
 import {ref,watch,onMounted} from "vue";
 import {useRouter, useRoute} from 'vue-router'
 import {useAppStore} from "~src/store";
+import HcCodeEditor from "./components/HcCodeEditor.vue";
 
 //初始变量
 const router = useRouter()
@@ -193,6 +194,10 @@ const formDataTable = ref([
         position: relative;
         padding-left: 24px;
         border-left: 1px solid #e4e7ed;
+        .http-form-res-box {
+            position: relative;
+            height: calc(100% - 60px);
+        }
     }
     .http-form-config, .http-form-data, .http-form-res {
         .title-box {

+ 1 - 1
src/views/other-file/image-view.vue

@@ -115,7 +115,7 @@ import WbsTree from "./components/WbsTree.vue"
 import HcTreeData from "./components/HcTreeData.vue"
 import imageApi from '~api/other-file/imageData';
 import {getStoreData, setStoreData} from '~src/utils/storage'
-import {downloadBlob, getArrValue, getObjNullValue} from "vue-utils-plus"
+import {downloadBlob, getArrValue, isString} from "vue-utils-plus"
 
 //变量
 const router = useRouter()

+ 0 - 7
vite.config.js

@@ -35,13 +35,6 @@ export default defineConfig({
             resolvers: [ElementPlusResolver()],
         }),
     ],
-    // 强制预构建插件包
-    optimizeDeps: {
-        include: [
-            `monaco-editor/esm/vs/language/json/json.worker`,
-            `monaco-editor/esm/vs/editor/editor.worker`
-        ],
-    },
     server: {
         //port: '3001',
         //host: '0.0.0.0',

+ 0 - 5
yarn.lock

@@ -852,11 +852,6 @@ mlly@^0.5.13, mlly@^0.5.7:
     pkg-types "^0.3.4"
     ufo "^0.8.5"
 
-monaco-editor@^0.34.0:
-  version "0.34.0"
-  resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.34.0.tgz#b1749870a1f795dbfc4dc03d8e9b646ddcbeefa7"
-  integrity sha512-VF+S5zG8wxfinLKLrWcl4WUizMx+LeJrG4PM/M78OhcwocpV0jiyhX/pG6Q9jIOhrb/ckYi6nHnaR5OojlOZCQ==
-
 ms@2.1.2:
   version "2.1.2"
   resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"