feat: 调整swagger-ui主题
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
<style>
|
||||
.theme-selector {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
top: 70px;
|
||||
right: 0px;
|
||||
z-index: 100;
|
||||
background: white;
|
||||
padding: 10px;
|
||||
@@ -25,6 +25,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
<div class="theme-selector">
|
||||
<label for="theme-select">选择主题: </label>
|
||||
<select id="theme-select" onchange="changeTheme(this.value)">
|
||||
@@ -44,6 +45,7 @@
|
||||
<option value="2.x-theme-outline.css">2.x-theme-outline.css</option>
|
||||
</select>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
@@ -53,7 +55,7 @@
|
||||
<script>
|
||||
// 主题映射表
|
||||
const themes = {
|
||||
'theme-default': '',
|
||||
'theme-default': '3.x/theme-material.css',
|
||||
'3.x-theme-material': '3.x/theme-material.css',
|
||||
'3.x-theme-monokai': '3.x/theme-monokai.css',
|
||||
'3.x-theme-feeling-blue': '3.x/theme-feeling-blue.css',
|
||||
@@ -87,7 +89,7 @@
|
||||
window.onload = function() {
|
||||
// 从本地存储恢复主题
|
||||
const savedTheme = localStorage.getItem('swagger-theme') || 'theme-material';
|
||||
document.getElementById('theme-select').value = savedTheme;
|
||||
// document.getElementById('theme-select').value = savedTheme;
|
||||
|
||||
if (savedTheme !== 'theme-default') {
|
||||
document.getElementById('swagger-theme').href = themes[savedTheme];
|
||||
|
||||
Reference in New Issue
Block a user