mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 11:57:12 +08:00
fix: context menu position (#1207)
* fix: context menu position * fix: context menu position with player disabled
This commit is contained in:
parent
66f9b4f526
commit
b501214c02
|
@ -15,6 +15,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'ContextMenu',
|
||||
data() {
|
||||
|
@ -24,10 +26,14 @@ export default {
|
|||
left: '0px',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(['player']),
|
||||
},
|
||||
methods: {
|
||||
setMenu(top, left) {
|
||||
let heightOffset = this.player.enabled ? 64 : 0;
|
||||
let largestHeight =
|
||||
window.innerHeight - this.$refs.menu.offsetHeight - 25;
|
||||
window.innerHeight - this.$refs.menu.offsetHeight - heightOffset;
|
||||
let largestWidth = window.innerWidth - this.$refs.menu.offsetWidth - 25;
|
||||
if (top > largestHeight) top = largestHeight;
|
||||
if (left > largestWidth) left = largestWidth;
|
||||
|
|
Loading…
Reference in New Issue
Block a user