惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
腾讯CDC
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
博客园_首页
D
DataBreaches.Net
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
月光博客
月光博客
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Vercel News
Vercel News
WordPress大学
WordPress大学
J
Java Code Geeks
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42

博客园 - 冰封的心

华为欧拉安装.net10 设置word中第一页不显示页码,第二页页码从1开始 阿里云OSS图片生成缩略图和获取视频的封面方法 nginx中部署vue3注意事项 pgsql:connection failed: connection to server at “::1“, port 5432 failed: : û “postgres“ P(修改密码) Windows下同版本的postgresql到入data/base目录下的数据库 Dapper添加postgresql分区表错误处理 nginx更新证书 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND 升级vite至最新版 JwtBearerEvents的订阅事件 .net 获取application/json参数 强制覆盖本地代码(与git远程仓库保持一致) JetBrains Resharper关闭行间自动补全 Postgresql序列操作 解决postgres数据库remaining connection slots are reserved for non-replication superuser connectio postgresql重置序列和自增主键 在C#中使用 CancellationToken 处理异步任务 电话脱敏SQL写法
SoybeanAdmin修改
冰封的心 · 2025-03-08 · via 博客园 - 冰封的心

1、菜单排序修改

目录:store->modules->route->shared.ts

修改函数:

/**
 * sort route by order
 * 如果后端采用的是DESC排序,前端将prev和next值调换,正如下面修改
 * @param route route
 */
function sortRouteByOrder(route: ElegantConstRoute) {
  if (route.children?.length) {
    route.children.sort(
      (next, prev) =>
        (Number(prev.meta?.order) || 0) - (Number(next.meta?.order) || 0),
    );
    route.children.forEach(sortRouteByOrder);
  }

  return route;
}

/**
 * sort routes by order
 * 降序
 * @param routes routes
 */
export function sortRoutesByOrder(routes: ElegantConstRoute[]) {
  routes.sort(
    (next, prev) =>
      (Number(prev.meta?.order) || 0) - (Number(next.meta?.order) || 0),
  );
  routes.forEach(sortRouteByOrder);

  return routes;
}

二、使用阿里icon

目录:components->custom -> svg-icon.vue

<script setup lang="ts">
import { computed, useAttrs } from 'vue';
import { Icon } from '@iconify/vue';
/*修改过的,加入了引入IconFont组件,阿里图标  */
defineOptions({ name: 'SvgIcon', inheritAttrs: false });

interface Props {
  /** Iconify icon name */
  icon?: string;
  /** Local svg icon name */
  localIcon?: string;
}

const props = defineProps<Props>();

const attrs = useAttrs();

const bindAttrs = computed<{ class: string; style: string }>(() => ({
  class: (attrs.class as string) || '',
  style: (attrs.style as string) || ''
}));

const symbolId = computed(() => {
  const { VITE_ICON_LOCAL_PREFIX: prefix } = import.meta.env;

  const defaultLocalIcon = 'no-icon';

  const icon = props.localIcon || defaultLocalIcon;

  return `#${prefix}-${icon}`;
});

/** If localIcon is passed, render localIcon first */
const renderLocalIcon = computed(() => props.localIcon || !props.icon);
/*处理阿里图标,图标开头为al- */
const iconName = computed(() => {
  return props.icon?.startsWith('al-') ? props.icon : ``;
});
const icon = computed(() => {
  return props.icon?.startsWith('al-') ? '' : props.icon;
});
</script>

<template>
  <template v-if="renderLocalIcon">
    <svg aria-hidden="true" width="1em" height="1em" v-bind="bindAttrs">
      <use :xlink:href="symbolId" fill="currentColor" />
    </svg>
  </template>
  <template v-else>
    <Icon v-if="icon" :icon="icon" v-bind="bindAttrs" />
    <icon-font v-if="iconName" :iconName="iconName" v-bind="bindAttrs"></icon-font>
  </template>
</template>

<style scoped lang="scss"></style>

 三、路由代理修改

#改写后端
路径:\build\config\proxy.ts
函数:createProxyItem
/* 旧的如果加了目录,则不能代理,比如:加了/admin目录,就不能代理/admin/login
rewrite: path => path.replace(new RegExp(`^${item.proxyPattern}`), '')
//下面这个也可用
rewrite: path => path.replace(new RegExp(`^${item.proxyPattern}`), item.proxyPattern)
// 可以原路返回,比如:/admin/login -> /admin/login
*/
rewrite: path => path

 后端路径

 src->utils->service.ts

/**
 * Get proxy pattern of backend service base url
 *
 * @param key If not set, will use the default key
 */
function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
  if (!key) {
    return '/admin';
  }

  return `/proxy-${key}`;
}