Browse Source

[click] debounce

wenliming 2 years ago
parent
commit
a98ea649c2
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/view/iframe/publish/tool-box/child/editor.vue

+ 5 - 5
src/view/iframe/publish/tool-box/child/editor.vue

@@ -55,7 +55,7 @@ import axios from 'axios';
 import { message } from "ant-design-vue";
 import { convertUrl, getAllPostEditorAppData } from "@/http/toolBoxApi";
 import { getChromeStorage } from "@/uilts/chromeExtension"
-import { checkURL } from "@/uilts/help"
+import { checkURL, debounce } from "@/uilts/help"
 
 const props = defineProps({
   linkInputDescImage: {
@@ -158,16 +158,16 @@ const getTitleByHtmlStr = (str = '') => {
   return str.substring(index1, index2) || '';
 };
 
-const clickHistoryAppHandler = (params) => {
+const clickHistoryAppHandler =  debounce(function(params) {
   if (params.appId) {
     clickAppHandler(params);
   } else {
     siteUrl.value = params.defaultUrl;
     searchHandler(params);
   }
-};
+}, 800);
 
-const clickAppHandler = (params) => {
+const clickAppHandler =  debounce(function(params) {
   let { createType, defaultUrl, appId, linkImagePath } = params;
   switch (createType) {
     case 1:
@@ -177,7 +177,7 @@ const clickAppHandler = (params) => {
       openWindow(params);
       break;
   }
-}
+}, 800);
 
 const openWindow = (params) => {
   chrome.windows.getCurrent({},