-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 1. useTemplate support attrs, props, emits with ref, reactive, …
…computed object 2. rename options.onUnmounted to options.hideOnUnmounted 3. add more test cases
- Loading branch information
1 parent
70883bf
commit e1fa815
Showing
11 changed files
with
367 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
import { defineAsyncComponent, h } from 'vue' | ||
import { Container, defineTemplate, useTemplate } from '../../src/index' | ||
const { show, hide } = useTemplate({ | ||
component: defineAsyncComponent(() => import('./DialogConfirm.vue')), | ||
attrs: { | ||
title: 'Hello World!', | ||
onConfirm: () => hide(), | ||
onCancel: () => hide(), | ||
}, | ||
slots: { | ||
default: defineTemplate({ | ||
component: () => h('p', 'This is a dialog content.'), | ||
}), | ||
}, | ||
}) | ||
show() | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<button @click="() => show()"> | ||
Open Modal | ||
</button> | ||
|
||
<Container /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { Container } from '../../src/index' | ||
import HideOnUnmountedDialog from './HideOnUnmountedDialog.vue' | ||
defineProps<{ | ||
hideOnUnmounted: boolean | ||
}>() | ||
const showOnUnmountedDialog = ref(true) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<HideOnUnmountedDialog v-if="showOnUnmountedDialog" :hide-on-unmounted="hideOnUnmounted" /> | ||
<button @click="() => showOnUnmountedDialog = false"> | ||
Hide OnUnmountedDialog | ||
</button> | ||
|
||
<Container /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script setup lang="ts"> | ||
import { h } from 'vue' | ||
import { useTemplate } from '../../src/index' | ||
const props = defineProps<{ | ||
hideOnUnmounted: boolean | ||
}>() | ||
const text = 'Hello World!' | ||
const { show } = useTemplate({ component: () => h('div', text) }, { | ||
hideOnUnmounted: props.hideOnUnmounted, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<button @click="() => show()"> | ||
Open Modal | ||
</button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.