Skip to content

Commit

Permalink
improve(leftbar): click outside close popover
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Asuka authored and ysfscream committed Oct 27, 2022
1 parent 694e4f6 commit 56030f1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/components/Leftbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
</div>
</div>
</el-popover>
<div :class="[{ active: isAbout || isHelp }, 'leftbar-item']" v-popover:popover @click="visible = !visible">
<div
:class="[{ active: isAbout || isHelp }, 'leftbar-item']"
v-popover:popover
@click="visible = !visible"
v-click-outside="() => (visible = false)"
>
<a href="javascript:;">
<i class="iconfont icon-help"></i>
</a>
Expand All @@ -65,9 +70,14 @@
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import { Getter } from 'vuex-class'
import ClickOutside from 'vue-click-outside'
import gaCustomLinks from '@/utils/gaCustomLinks'
@Component
@Component({
directives: {
ClickOutside,
},
})
export default class Leftbar extends Vue {
@Getter('currentLang') private getterLang!: Language
Expand Down
14 changes: 12 additions & 2 deletions web/src/components/Leftbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@
</div>
</div>
</el-popover>
<div :class="[{ active: isAbout || isHelp }, 'leftbar-item']" v-popover:popover @click="visible = !visible">
<div
:class="[{ active: isAbout || isHelp }, 'leftbar-item']"
v-popover:popover
@click="visible = !visible"
v-click-outside="() => (visible = false)"
>
<a href="javascript:;">
<i class="iconfont icon-help"></i>
</a>
Expand All @@ -53,8 +58,13 @@
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import { Getter } from 'vuex-class'
import ClickOutside from 'vue-click-outside'
@Component
@Component({
directives: {
ClickOutside,
},
})
export default class Leftbar extends Vue {
@Getter('currentLang') private getterLang!: Language
Expand Down

0 comments on commit 56030f1

Please sign in to comment.