File tree Expand file tree Collapse file tree 2 files changed +11
-19
lines changed
packages/anu-vue/src/components Expand file tree Collapse file tree 2 files changed +11
-19
lines changed Original file line number Diff line number Diff line change 1
1
<script lang="ts" setup>
2
- import type { Ref } from ' vue'
3
2
import { ACard , cardProps } from ' @/components/card'
4
3
import { useDOMScrollLock } from ' @/composables/useDOMScrollLock'
5
4
import { defuProps } from ' @/composables/useProps'
6
5
import { useTeleport } from ' @/composables/useTeleport'
6
+ import type { Ref } from ' vue'
7
7
8
8
const props = defineProps (defuProps ({
9
9
/**
@@ -30,15 +30,11 @@ const { teleportTarget } = useTeleport()
30
30
const isMounted = useMounted ()
31
31
32
32
const refCard = ref ()
33
- if (! props .persistent ) {
34
- onClickOutside (refCard , () => {
35
- // If dialog is not open => Don't execute
36
- if (! props .modelValue )
37
- return
38
-
33
+ onClickOutside (refCard , () => {
34
+ // If dialog is open & persistent prop is false => Close dialog
35
+ if (props .modelValue && ! props .persistent )
39
36
emit (' update:modelValue' , false )
40
- })
41
- }
37
+ })
42
38
43
39
// Lock DOM scroll when modelValue is `true`
44
40
// ℹ️ We need to use type assertion here because of this issue: https://github.com/johnsoncodehk/volar/issues/2219
Original file line number Diff line number Diff line change 1
1
<script lang="ts" setup>
2
- import { defu } from ' defu'
3
- import type { PropType , Ref } from ' vue'
4
2
import { ACard , cardProps } from ' @/components/card'
5
3
import { useDOMScrollLock } from ' @/composables/useDOMScrollLock'
6
4
import { useTeleport } from ' @/composables/useTeleport'
5
+ import { defu } from ' defu'
6
+ import type { PropType , Ref } from ' vue'
7
7
8
8
const props = defineProps (defu ({
9
9
/**
@@ -38,15 +38,11 @@ const { teleportTarget } = useTeleport()
38
38
const isMounted = useMounted ()
39
39
40
40
const refCard = ref ()
41
- if (! props .persistent ) {
42
- onClickOutside (refCard , () => {
43
- // If dialog is not open => Don't execute
44
- if (! props .modelValue )
45
- return
46
-
41
+ onClickOutside (refCard , () => {
42
+ // If dialog is open & persistent prop is false => Close drawer
43
+ if (props .modelValue && ! props .persistent )
47
44
emit (' update:modelValue' , false )
48
- })
49
- }
45
+ })
50
46
51
47
const transitionName = computed (() => {
52
48
if (props .anchor === ' bottom' )
You can’t perform that action at this time.
0 commit comments