Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

fix(menu): 对菜单做了一些调整和优化。 #267

Merged
merged 2 commits into from
Nov 24, 2020
Merged
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
7 changes: 7 additions & 0 deletions src/components/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -868,3 +868,10 @@ body {
left: 0;
}
}

.card-header-fixed .ant-card-head {
position: fixed;
background: white;
z-index: 999;
top: 0;
}
22 changes: 21 additions & 1 deletion src/views/interface/MenuList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
:xs="24"
class="pb-3"
>
<a-card :bodyStyle="{ padding: '16px' }">
<a-card
:bodyStyle="{ padding: '16px' }"
ref="mheader"
:class="{ 'card-header-fixed': headerIsFixed }"
:headStyle="headStyle"
>
<template slot="title">
<span>
{{ menuListTitle }}
Expand Down Expand Up @@ -220,6 +225,8 @@ export default {
menuInternalLinkSelector: {
visible: false,
},
headerIsFixed: false,
headStyle: {},
}
},
computed: {
Expand Down Expand Up @@ -260,10 +267,16 @@ export default {
defaultMenuTeam() {
return this.options.default_menu_team ? this.options.default_menu_team : ''
},
mHeaderFromTopAbs() {
return Math.floor(Math.abs(this.mHeaderFromTop))
},
},
created() {
this.handleListTeams()
},
mounted() {
window.addEventListener('scroll', this.scrollHandle, true)
},
methods: {
...mapActions(['refreshOptionsCache']),
handleListTeams(autoSelectTeam = false) {
Expand Down Expand Up @@ -403,6 +416,13 @@ export default {
this.refreshOptionsCache()
}
},

scrollHandle: function(e) {
if (this.$refs.mheader.$el !== undefined) {
this.headerIsFixed = this.$refs.mheader.$el.getBoundingClientRect().top < 0
this.$set(this.headStyle, 'width', this.$refs.mheader.$el.offsetWidth + 'px')
}
},
},
}
</script>
4 changes: 3 additions & 1 deletion src/views/interface/components/MenuTreeNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ export default {
computed: {
dragOptions() {
return {
animation: 300,
animation: 100,
group: 'description',
disabled: false,
ghostClass: 'ghost',
forceFallback: true,
emptyInsertThreshold: 20,
}
},
realValue() {
Expand Down