Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/en-US/features/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"installTime": "Last Modified",
"name": "Name",
"stars": "Stars",
"downloads": "Downloads",
"author": "Author",
"updated": "Last Updated",
"updateStatus": "Update Status",
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/ru-RU/features/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"installTime": "Дате установки",
"name": "Имени",
"stars": "Звездам",
"downloads": "Количеству скачиваний",
"author": "Автору",
"updated": "Дате обновления",
"updateStatus": "Статусу обновления",
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/zh-CN/features/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"installTime": "最后修改时间",
"name": "名称",
"stars": "Star数",
"downloads": "下载量",
"author": "作者名",
"updated": "更新时间",
"updateStatus": "更新状态",
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/views/extension/MarketPluginsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const currentSourceName = computed(() => {
const marketSortItems = computed(() => [
{ title: tm("sort.default"), value: "default" },
{ title: tm("sort.stars"), value: "stars" },
{ title: tm("sort.downloads"), value: "downloads" },
{ title: tm("sort.author"), value: "author" },
{ title: tm("sort.updated"), value: "updated" },
]);
Expand Down
11 changes: 10 additions & 1 deletion dashboard/src/views/extension/useExtensionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const useExtensionPage = (initialTab = "installed") => {
const marketSearch = ref("");
const debouncedMarketSearch = ref("");
const refreshingMarket = ref(false);
const sortBy = ref("default"); // default, stars, author, updated
const sortBy = ref("default"); // default, stars, downloads, author, updated
const sortOrder = ref("desc"); // desc (降序) or asc (升序)
const randomPluginNames = ref([]);
const marketCategoryFilter = ref("all");
Expand Down Expand Up @@ -392,6 +392,15 @@ export const useExtensionPage = (initialTab = "installed") => {
const starsB = b.stars ?? 0;
return sortOrder.value === "desc" ? starsB - starsA : starsA - starsB;
});
} else if (sortBy.value === "downloads") {
// 按下载量排序
plugins.sort((a, b) => {
const downloadsA = a.download_count ?? 0;
const downloadsB = b.download_count ?? 0;
return sortOrder.value === "desc"
? downloadsB - downloadsA
: downloadsA - downloadsB;
});
} else if (sortBy.value === "author") {
// 按作者名字典序排序
plugins.sort((a, b) => {
Expand Down
Loading