feat: use withDefaults and defineOptions in Modal
This commit is contained in:
parent
20701ce07a
commit
b1a8bbe760
@ -66,41 +66,39 @@
|
|||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
inheritAttrs: false,
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import CustomTransition from '@/components/misc/CustomTransition.vue'
|
import CustomTransition from '@/components/misc/CustomTransition.vue'
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
import {ref, useAttrs, watchEffect} from 'vue'
|
import {ref, useAttrs, watchEffect} from 'vue'
|
||||||
import {useScrollLock} from '@vueuse/core'
|
import {useScrollLock} from '@vueuse/core'
|
||||||
|
|
||||||
const {
|
const props = withDefaults(defineProps<{
|
||||||
enabled = true,
|
|
||||||
overflow,
|
|
||||||
wide,
|
|
||||||
transitionName = 'modal',
|
|
||||||
variant = 'default',
|
|
||||||
} = defineProps<{
|
|
||||||
enabled?: boolean,
|
enabled?: boolean,
|
||||||
overflow?: boolean,
|
overflow?: boolean,
|
||||||
wide?: boolean,
|
wide?: boolean,
|
||||||
transitionName?: 'modal' | 'fade',
|
transitionName?: 'modal' | 'fade',
|
||||||
variant?: 'default' | 'hint-modal' | 'scrolling',
|
variant?: 'default' | 'hint-modal' | 'scrolling',
|
||||||
}>()
|
}>(), {
|
||||||
|
enabled: true,
|
||||||
|
overflow: false,
|
||||||
|
wide: false,
|
||||||
|
transitionName: 'modal',
|
||||||
|
variant: 'default',
|
||||||
|
})
|
||||||
|
|
||||||
defineEmits(['close', 'submit'])
|
defineEmits(['close', 'submit'])
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
const attrs = useAttrs()
|
const attrs = useAttrs()
|
||||||
|
|
||||||
const modal = ref<HTMLElement | null>(null)
|
const modal = ref<HTMLElement | null>(null)
|
||||||
const scrollLock = useScrollLock(modal)
|
const scrollLock = useScrollLock(modal)
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
scrollLock.value = enabled
|
scrollLock.value = props.enabled
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user