mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	fix: delete toggleTheme.ts
This commit is contained in:
		
							parent
							
								
									3851d284bf
								
							
						
					
					
						commit
						b248d9ea31
					
				@ -1,19 +0,0 @@
 | 
				
			|||||||
export const toggleTheme = (scopeName = "theme-default") => {
 | 
					 | 
				
			||||||
  let styleLink: any = document.getElementById("theme-button");
 | 
					 | 
				
			||||||
  if (styleLink) {
 | 
					 | 
				
			||||||
    // 假如存在id为theme-button 的link标签,直接修改其href
 | 
					 | 
				
			||||||
    styleLink.href = `/${scopeName}.css`;
 | 
					 | 
				
			||||||
    // 注:如果是removeCssScopeName:true移除了主题文件的权重类名,就可以不用修改className 操作
 | 
					 | 
				
			||||||
    document.documentElement.className = scopeName;
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    // 不存在的话,则新建一个
 | 
					 | 
				
			||||||
    styleLink = document.createElement("link");
 | 
					 | 
				
			||||||
    styleLink.type = "text/css";
 | 
					 | 
				
			||||||
    styleLink.rel = "stylesheet";
 | 
					 | 
				
			||||||
    styleLink.id = "theme-button";
 | 
					 | 
				
			||||||
    styleLink.href = `/${scopeName}.css`;
 | 
					 | 
				
			||||||
    // 注:如果是removeCssScopeName:true移除了主题文件的权重类名,就可以不用修改className 操作
 | 
					 | 
				
			||||||
    document.documentElement.className = scopeName;
 | 
					 | 
				
			||||||
    document.head.append(styleLink);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user