Pārlūkot izejas kodu

优化(防抖)

seimin 1 gadu atpakaļ
vecāks
revīzija
ff839d0c57
2 mainītis faili ar 9 papildinājumiem un 8 dzēšanām
  1. 2 2
      config/index.js
  2. 7 6
      src/views/referenceList.vue

+ 2 - 2
config/index.js

@@ -14,7 +14,7 @@ module.exports = {
14 14
     proxyTable: {
15 15
       '/service': {//自定义名字,代表的是以下target中的内容
16 16
         // target: host.host+'/service/',//微信
17
-        target: 'http://192.168.4.105',//微信
17
+        target: 'http://192.168.3.111',//微信
18 18
         changeOrigin: true,//是否允许跨域
19 19
         // pathRewrite: {
20 20
         //   '^/service': ''
@@ -22,7 +22,7 @@ module.exports = {
22 22
       },
23 23
       '/file': {//自定义名字,代表的是以下target中的内容
24 24
         // target: host.host+'/service/',//微信
25
-        target: 'http://192.168.4.105',//微信
25
+        target: 'http://192.168.3.111',//微信
26 26
         changeOrigin: true,//是否允许跨域
27 27
         // pathRewrite: {
28 28
         //   '^/service': ''

+ 7 - 6
src/views/referenceList.vue

@@ -71,6 +71,7 @@
71 71
 </template>
72 72
 <script>
73 73
 import Vue from "vue";
74
+import { debounce } from 'lodash';
74 75
 import CubePage from "../components/cube-page.vue";
75 76
 import SwitchOption from "../components/switch-option";
76 77
 import InputOption from "../components/input-option";
@@ -139,12 +140,12 @@ export default {
139 140
         this.search = this.$route.params.keword;
140 141
       }
141 142
     },
142
-    searchFn() {
143
-      var that = this;
144
-      that.loadShow = true;
145
-      that.items=[]
146
-      that.getData()
147
-    },
143
+    searchFn:debounce(function () {
144
+      // 处理输入变化事件的逻辑
145
+      this.loadShow = true;
146
+      this.items=[]
147
+      this.getData()
148
+    }, 300),
148 149
     toKnowDetails(data) {
149 150
       // this.$router.push({path:'/knowDetails'})
150 151
       this.$router.push({