فهرست منبع

feat: 新增自定义主题

forestho 3 ماه پیش
والد
کامیت
9072052a98
2فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 6 0
      public/theme/custom.json
  2. 9 1
      src/views/components/View.vue

+ 6 - 0
public/theme/custom.json

@@ -0,0 +1,6 @@
+[
+    "background: #fcf3cf",
+    "textColor-9: #f1948a",
+    "tableMenuBg: #F0F8FF",
+    "buttonBg: #2e4053"
+]

+ 9 - 1
src/views/components/View.vue

@@ -998,6 +998,8 @@ onMounted(() => {
   window.onbeforeunload = () => {
     autoSave();
   };
+  // 注册自定义主题
+  registerLe5leTheme();
 });
 
 onUnmounted(()=>{
@@ -2171,7 +2173,13 @@ const onSelDataset = async (init = false) => {
     }
   }
 };
-
+const registerLe5leTheme = ()=>{
+  fetch((cdn ? cdn + '/v' : import.meta.env.BASE_URL.slice(0, -1)) + '/theme/custom.json')
+    .then((r) => r.json())
+    .then((theme) => {
+      meta2d.registerTheme('custom',theme);
+    });
+}
 const mergeDataset = (arr1:any,arr2:any[]) => {
   if(!(arr2&&arr2.length)){
     return;