Right-click context menu doesnt close when opening another #41

This commit is contained in:
Daan 2020-09-14 20:38:56 +02:00
parent 2117a5c46b
commit faedfa7172
3 changed files with 78 additions and 81 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "vuetorrent", "name": "vuetorrent",
"version": "0.3.0", "version": "0.3.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View file

@ -10,7 +10,6 @@
<v-tooltip top> <v-tooltip top>
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
<v-layout <v-layout
@contextmenu.prevent="$refs.menu.open"
v-on="on" v-on="on"
row row
wrap wrap
@ -128,27 +127,16 @@
<span>{{ torrent.name }}</span> <span>{{ torrent.name }}</span>
</v-tooltip> </v-tooltip>
<v-divider></v-divider> <v-divider></v-divider>
<vue-context ref="menu">
<TorrentRightClickMenu :hash="torrent.hash" />
</vue-context>
</v-card> </v-card>
</template> </template>
<script> <script>
import { VueContext } from 'vue-context'
import 'vue-context/src/sass/vue-context.scss'
import TorrentRightClickMenu from '@/components/Torrent/TorrentRightClickMenu.vue'
import { General } from '@/mixins' import { General } from '@/mixins'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'Torrent', name: 'Torrent',
components: {
VueContext,
TorrentRightClickMenu
},
mixins: [General], mixins: [General],
props: { props: {
@ -244,13 +232,3 @@ export default {
} }
} }
</script> </script>
<style scoped lang="scss">
.v-context {
&,
& ul {
border-radius: 0.3rem;
padding: 0;
}
}
</style>

View file

@ -8,7 +8,6 @@
class="my-4 pt-5 pa-0" class="my-4 pt-5 pa-0"
@click.self="resetSelected" @click.self="resetSelected"
> >
<!-- justify-center here in layout to center!! -->
<v-flex xs12 sm6 md3 @click.self="resetSelected"> <v-flex xs12 sm6 md3 @click.self="resetSelected">
<v-text-field <v-text-field
flat flat
@ -24,11 +23,18 @@
<p class="grey--text">No active Torrents!</p> <p class="grey--text">No active Torrents!</p>
</div> </div>
<div v-else> <div v-else>
<div v-for="torrent in torrents" :key="torrent.hash"> <div
@contextmenu.prevent="$refs.menu.open($event, { torrent })"
v-for="torrent in torrents"
:key="torrent.hash"
>
<Torrent :torrent="torrent" /> <Torrent :torrent="torrent" />
</div> </div>
</div> </div>
</v-container> </v-container>
<vue-context ref="menu" v-slot="{ data }">
<TorrentRightClickMenu v-if="data" :hash="data.torrent.hash" />
</vue-context>
</div> </div>
</template> </template>
@ -36,10 +42,13 @@
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Torrent from '@/components/Torrent' import Torrent from '@/components/Torrent'
import Fuse from 'fuse.js' import Fuse from 'fuse.js'
import { VueContext } from 'vue-context'
import 'vue-context/src/sass/vue-context.scss'
import TorrentRightClickMenu from '@/components/Torrent/TorrentRightClickMenu.vue'
export default { export default {
name: 'Dashboard', name: 'Dashboard',
components: { Torrent }, components: { Torrent, VueContext, TorrentRightClickMenu },
data() { data() {
return { return {
input: '' input: ''
@ -81,3 +90,13 @@ export default {
} }
} }
</script> </script>
<style scoped lang="scss">
.v-context {
&,
& ul {
border-radius: 0.3rem;
padding: 0;
}
}
</style>