mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-08 17:40:08 +08:00
![wangdan-fit2cloud](/assets/img/avatar_default.png)
#### What this PR does / why we need it? #### Summary of your change #### Please indicate you've done the following: - [ ] Made sure tests are passing and test coverage is added if needed. - [ ] Made sure commit message follow the rule of [Conventional Commits specification](https://www.conventionalcommits.org/). - [ ] Considered the docs impact and opened a new docs issue or PR with docs changes if needed.
56 lines
1.2 KiB
Vue
56 lines
1.2 KiB
Vue
<template>
|
|
<div>
|
|
<div v-if="showButton">
|
|
<RouterButton :buttons="buttons" />
|
|
</div>
|
|
<LayoutContent>
|
|
<router-view></router-view>
|
|
</LayoutContent>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import i18n from '@/lang';
|
|
import { onMounted, ref } from 'vue';
|
|
import { SearchAppInstalled } from '@/api/modules/app';
|
|
import bus from './bus';
|
|
let showButton = ref(false);
|
|
const buttons = [
|
|
{
|
|
label: i18n.global.t('app.all'),
|
|
path: '/apps/all',
|
|
},
|
|
{
|
|
label: i18n.global.t('app.installed'),
|
|
path: '/apps/installed',
|
|
},
|
|
{
|
|
label: i18n.global.t('app.canUpgrade'),
|
|
path: '/apps/upgrade',
|
|
count: 0,
|
|
},
|
|
];
|
|
|
|
const search = () => {
|
|
SearchAppInstalled({ update: true, page: 1, pageSize: 100 })
|
|
.then((res) => {
|
|
if (res.data.items) {
|
|
buttons[2].count = res.data.items.length;
|
|
} else {
|
|
buttons[2].count = 0;
|
|
}
|
|
})
|
|
.finally(() => {
|
|
showButton.value = true;
|
|
});
|
|
};
|
|
|
|
onMounted(() => {
|
|
search();
|
|
bus.on('upgrade', () => {
|
|
showButton.value = false;
|
|
search();
|
|
});
|
|
});
|
|
</script>
|