Ver código fonte

chore: notification ued doc not jump

DaiQiangReal 3 anos atrás
pai
commit
56e77cc0e8
1 arquivos alterados com 20 adições e 20 exclusões
  1. 20 20
      src/templates/toUEDUtils/toUED.ts

+ 20 - 20
src/templates/toUEDUtils/toUED.ts

@@ -4,7 +4,7 @@ const getSite=()=>{
     const currentUrlSplit=window.location.pathname.split('/').filter(s=>s);
     const site=currentUrlSplit[0]==='design'?'design':'main';
     return site;
-}
+};
 
 
 
@@ -12,12 +12,12 @@ const getAnotherSideUrl=(site:'design'|'main')=>{
     const currentUrlSplit=window.location.pathname.split('/').filter(s=>s);
     const url=currentUrlSplit.slice(currentUrlSplit.length-2);
     const locale=/zh-CN/.test(window.location.pathname)?'zh-CN':'en-US';
-    if(site==='main'){
+    if (site==='main'){
         return `${window.location.origin}/${locale}/${url[0]}/${url[1]}`;
-    }else{
+    } else {
         return `${window.location.origin}/design/${locale}/${url[0]}/${url[1]}`;
     }
-}
+};
 
 
 const cache={scrollHeight:null};
@@ -25,24 +25,24 @@ const cache={scrollHeight:null};
 const transContent=(site:'main'|'design')=>{
     const url=`${getAnotherSideUrl('design')}?concisemode=true`;
     const mainSiteContentDOM= document.querySelector('.main-article') as HTMLDivElement;
-    if(site==='design'){
+    if (site==='design'){
         mainSiteContentDOM.style['display']='none';
         let iframeContainer=document.querySelector('#iframeContainer') as HTMLDivElement;
-        if(iframeContainer){
+        if (iframeContainer){
             iframeContainer.style['display']='block';
             iframeContainer.style['margin-bottom']='120px';
             const iframeDOM=iframeContainer.querySelector('iframe');
-            if(iframeDOM.getAttribute('src')!==url){
+            if (iframeDOM.getAttribute('src')!==url){
                 iframeDOM.setAttribute('src',url);
             }
-            if(cache.scrollHeight){
+            if (cache.scrollHeight){
                 iframeContainer.style['height']=cache['scrollHeight'];
                 iframeDOM.style['height']=cache['scrollHeight'];
             }
-        }else{
+        } else {
             iframeContainer=document.createElement('div') as HTMLDivElement;
             iframeContainer.setAttribute('class','iframeContainer');
-            iframeContainer.setAttribute('id','iframeContainer')
+            iframeContainer.setAttribute('id','iframeContainer');
             const iframeDOM=document.createElement('iframe');
             iframeDOM.setAttribute('src',url);
             iframeDOM.setAttribute('scrolling','no');
@@ -50,13 +50,13 @@ const transContent=(site:'main'|'design')=>{
                 console.log('message',e.data);
                 try {
                     const data=JSON.parse(e.data);
-                    if(data['scrollHeight']){
+                    if (data['scrollHeight']){
                         iframeDOM.style['height']=`${data['scrollHeight']}px`;
                         iframeContainer.style['height']=`${data['scrollHeight']}px`;
                         console.log('height===>',data['scrollHeight']);
                         cache['scrollHeight']=`${data['scrollHeight']}px`;
                     }
-                }catch (e){
+                } catch (e){
                     console.log('getMessage ====>',e);
                 }
             });
@@ -68,38 +68,38 @@ const transContent=(site:'main'|'design')=>{
 
 
 
-    } else{
+    } else {
         mainSiteContentDOM.style['display']='block';
         const iframeContainer=document.querySelector('#iframeContainer') as HTMLDivElement;
         iframeContainer.style['display']='none';
     }
-}
+};
 
 const isHaveUedDocs=(pathName:string)=>{
 
-    if(pathName){
+    if (pathName){
         const urlSplitArray=pathName.split('/').filter(v=>v);
         const componentName=urlSplitArray[urlSplitArray.length-1];
         return haveUedDocComponents.includes(componentName);
     }
     return false;
-}
+};
 
 const isJumpToDesignSite=(pathName:string)=>{
-    const components=['toast','notification','popconfirm','scrolllist','popover','select','dropdown'];
-    if(pathName){
+    const components=['toast','popconfirm','scrolllist','popover','select','dropdown'];
+    if (pathName){
         const urlSplitArray=pathName.split('/').filter(v=>v);
         const componentName=urlSplitArray[urlSplitArray.length-1];
         return components.includes(componentName);
     }
     return false;
-}
+};
 
 export {
     isHaveUedDocs,
     isJumpToDesignSite,
     getAnotherSideUrl
-}
+};
 
 export default transContent;