|  | @@ -125,6 +125,56 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        //     event.preventDefault();
 | 
	
		
			
				|  |  |        //   }
 | 
	
		
			
				|  |  |        // });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      /**
 | 
	
		
			
				|  |  | +       * DNS 解析耗时: domainLookupEnd - domainLookupStart
 | 
	
		
			
				|  |  | +       * TCP 连接耗时: connectEnd - connectStart
 | 
	
		
			
				|  |  | +       * SSL 安全连接耗时: connectEnd - secureConnectionStart
 | 
	
		
			
				|  |  | +       * 网络请求耗时 (TTFB): responseStart - requestStart
 | 
	
		
			
				|  |  | +       *数据传输耗时: responseEnd - responseStart
 | 
	
		
			
				|  |  | +        *DOM 解析耗时: domInteractive - responseEnd
 | 
	
		
			
				|  |  | +        *资源加载耗时: loadEventStart - domContentLoadedEventEnd
 | 
	
		
			
				|  |  | +        *First Byte时间: responseStart - domainLookupStart
 | 
	
		
			
				|  |  | +        *白屏时间: responseEnd - fetchStart
 | 
	
		
			
				|  |  | +        *首次可交互时间: domInteractive - fetchStart
 | 
	
		
			
				|  |  | +        *DOM Ready 时间: domContentLoadEventEnd - fetchStart
 | 
	
		
			
				|  |  | +        *页面完全加载时间: loadEventStart - fetchStart
 | 
	
		
			
				|  |  | +        *http 头部大小: transferSize - encodedBodySize
 | 
	
		
			
				|  |  | +        *重定向次数:performance.navigation.redirectCount
 | 
	
		
			
				|  |  | +        *重定向耗时: redirectEnd - redirectStart
 | 
	
		
			
				|  |  | +       */
 | 
	
		
			
				|  |  | +        window.onload = function() {
 | 
	
		
			
				|  |  | +          console.log('加载完成')
 | 
	
		
			
				|  |  | +          let timing: any = performance.getEntriesByType('navigation')[0];
 | 
	
		
			
				|  |  | +          const { domainLookupEnd, domainLookupStart, connectEnd, connectStart, responseStart,
 | 
	
		
			
				|  |  | +            requestStart, responseEnd, domInteractive, loadEventStart, domContentLoadedEventEnd,
 | 
	
		
			
				|  |  | +            fetchStart, secureConnectionStart, transferSize, encodedBodySize,
 | 
	
		
			
				|  |  | +            redirectEnd, redirectStart
 | 
	
		
			
				|  |  | +          } = timing
 | 
	
		
			
				|  |  | +          //console.log(timing.domInteractive);
 | 
	
		
			
				|  |  | +          //console.log(timing.fetchStart);
 | 
	
		
			
				|  |  | +          let diff = timing.domInteractive - timing.fetchStart;
 | 
	
		
			
				|  |  | +          //console.log("TTI: " + diff);
 | 
	
		
			
				|  |  | +          const timeInfo = [
 | 
	
		
			
				|  |  | +            { '类型': 'DNS 解析耗时', '耗时': domainLookupEnd - domainLookupStart},
 | 
	
		
			
				|  |  | +            { '类型': 'TCP 连接耗时', '耗时': connectEnd - connectStart},
 | 
	
		
			
				|  |  | +            { '类型': 'SSL 安全连接耗时', '耗时': connectEnd - secureConnectionStart},
 | 
	
		
			
				|  |  | +            { '类型': '网络请求耗时', '耗时': responseStart - requestStart},
 | 
	
		
			
				|  |  | +            { '类型': '数据传输耗时', '耗时': responseEnd - responseStart},
 | 
	
		
			
				|  |  | +            { '类型': 'DOM 解析耗时', '耗时': domInteractive - responseEnd},
 | 
	
		
			
				|  |  | +            { '类型': '资源加载耗时', '耗时': loadEventStart - domContentLoadedEventEnd},
 | 
	
		
			
				|  |  | +            { '类型': 'First Byte时间', '耗时': responseStart - domainLookupStart},
 | 
	
		
			
				|  |  | +            { '类型': '白屏时间', '耗时': responseEnd - fetchStart},
 | 
	
		
			
				|  |  | +            { '类型': '首次可交互时间', '耗时': domInteractive - fetchStart},
 | 
	
		
			
				|  |  | +            { '类型': 'DOM Ready 时间', '耗时': domContentLoadedEventEnd - fetchStart},
 | 
	
		
			
				|  |  | +            { '类型': '页面完全加载时间', '耗时': loadEventStart - fetchStart},
 | 
	
		
			
				|  |  | +            { '类型': 'http 头部大小', '耗时': transferSize - encodedBodySize},
 | 
	
		
			
				|  |  | +            { '类型': '重定向次数', '耗时': performance.navigation.redirectCount},
 | 
	
		
			
				|  |  | +            { '类型': '重定向耗时', '耗时': redirectEnd - redirectStart},
 | 
	
		
			
				|  |  | +          ];
 | 
	
		
			
				|  |  | +          console.table(timeInfo);
 | 
	
		
			
				|  |  | +          
 | 
	
		
			
				|  |  | +        };      
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      onUnmounted(() => {
 |