diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index ef32478..7b7e20c 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2806,7 +2806,6 @@ export default { child.map(item => { if (orderProp === item.orderProp && this.sortable.order === item.order) { item.iconClass = 'menu-' + this.sortable.order - console.log('当前排序:', item.order) } else { item.iconClass = 'menu-null' } diff --git a/src/components/SortDropdown/index.vue b/src/components/SortDropdown/index.vue index 41341bc..6164758 100644 --- a/src/components/SortDropdown/index.vue +++ b/src/components/SortDropdown/index.vue @@ -22,7 +22,7 @@ :divided="item.order === 'ascending' && item.key !== 'name-asc'" > - + {{ item.label }} @@ -56,33 +56,29 @@ export default { computed: { // 生成完整的排序选项(包含顺序和倒序) allSortOptions() { - const options = [] - this.sortOptions.forEach(option => { - // 顺序选项 - options.push({ + return this.sortOptions.flatMap(option => [ + { key: `${option.prop}-asc`, command: `${option.command}-ascending`, prop: option.prop, order: 'ascending', title: option.title, label: `${option.title} - 顺序` - }) - // 倒序选项 - options.push({ + }, + { key: `${option.prop}-desc`, command: `${option.command}-descending`, prop: option.prop, order: 'descending', title: option.title, label: `${option.title} - 倒序` - }) - }) - return options + } + ]) }, // 当前排序字段的显示名称 currentSortName() { const currentOption = this.sortOptions.find(option => option.prop === this.sortable.prop) - return currentOption.title + return currentOption ? currentOption.title : '' }, // 当前排序方向 currentSortOrder() { @@ -129,7 +125,7 @@ export default { } /* 确保图标和文字垂直对齐 */ -.al-file-sort-item-icon /deep/ svg { +.al-file-sort-item-icon >>> svg { width: 14px; height: 14px; vertical-align: middle; diff --git a/src/utils/file-operations.js b/src/utils/file-operations.js index ab96e03..cf75a7d 100644 --- a/src/utils/file-operations.js +++ b/src/utils/file-operations.js @@ -27,10 +27,10 @@ export const fileArrangements = [ { label: '大小 - 倒序', operation: 'orderSize-descending', orderProp: 'size', order: 'descending'}, { divider: true, operation: 'divider' }, { label: '上传时间 - 顺序', operation: 'orderUploadDate-ascending', orderProp: 'uploadDate', order: 'ascending'}, - { label: '上传时间 - 倒序', operation: 'orderUploadDate-descending', orderProp: 'uploadDate', order: 'ascending'}, + { label: '上传时间 - 倒序', operation: 'orderUploadDate-descending', orderProp: 'uploadDate', order: 'descending'}, { divider: true, operation: 'divider' }, { label: '修改时间 - 顺序', operation: 'orderUpdateDate-ascending', orderProp: 'updateDate', order: 'ascending'}, - { label: '修改时间 - 倒序', operation: 'orderUpdateDate-descending', orderProp: 'updateDate', order: 'ascending'}, + { label: '修改时间 - 倒序', operation: 'orderUpdateDate-descending', orderProp: 'updateDate', order: 'descending'}, ] export const createFiles = [