mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 16:00:51 +00:00
feat: enhance app icon retrieval logic in home view (#11745)
- Updated app icon handling to use a dedicated function for improved clarity and maintainability. - Introduced a new method, getAppIconSrc, to manage icon source retrieval based on app properties. - Ensured proper handling of base64 and URL-based icons for better performance and consistency.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<div class="h-app-card" v-for="(app, index) in apps" :key="index">
|
||||
<el-row :gutter="5">
|
||||
<el-col :span="5">
|
||||
<el-avatar shape="square" :size="55" :src="'data:image/png;base64,' + app.icon" />
|
||||
<el-avatar shape="square" :size="55" :src="getAppIconSrc(app)" />
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<div class="h-app-content" v-if="!app.currentRow">
|
||||
@@ -179,7 +179,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { installedOp } from '@/api/modules/app';
|
||||
import { getAppIconUrl, installedOp } from '@/api/modules/app';
|
||||
import { getAgentSettingByKey } from '@/api/modules/setting';
|
||||
import { changeLauncherStatus, loadAppLauncher, loadAppLauncherOption } from '@/api/modules/dashboard';
|
||||
import i18n from '@/lang';
|
||||
@@ -291,6 +291,14 @@ const loadOption = async () => {
|
||||
options.value = res.data || [];
|
||||
};
|
||||
|
||||
const getAppIconSrc = (app: any) => {
|
||||
const icon = app?.icon || '';
|
||||
if (icon.startsWith('app_') || icon === '') {
|
||||
return getAppIconUrl(app.key);
|
||||
}
|
||||
return `data:image/png;base64,${icon}`;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user