File tree Expand file tree Collapse file tree 6 files changed +91
-5
lines changed
Expand file tree Collapse file tree 6 files changed +91
-5
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export default defineClientConfig({
1919 registerComponent ( 'FeaturesExampleConfirmHard' )
2020 registerComponent ( 'FeaturesExamplePrompt' )
2121 registerComponent ( 'FeaturesExampleDirective' )
22+ registerComponent ( 'OptionsExampleAnimation' )
23+ registerComponent ( 'OptionsExampleLoader' )
2224 } ,
2325 setup ( ) { } ,
2426 rootComponents : [ ] ,
Original file line number Diff line number Diff line change 1616 body: ' What is the most important thing in life?' ,
1717 }, {
1818 cancelText: ' Dismiss' ,
19- okText: ' Yes ' ,
19+ okText: ' Done ' ,
2020 promptHelp: ' Type in the box below and click "[+:okText]"'
2121 }).then (result => {
22- console .log ({ result })
22+ if (result .canceled ) return ;
23+ $dialog .alert (JSON .stringify (result))
2324 })
2425 </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <UIExamplesButton @click =" openDialog('zoom')" >Zoom</UIExamplesButton >  ;
3+ <UIExamplesButton @click =" openDialog('fade')" >Fade</UIExamplesButton >  ;
4+ <UIExamplesButton @click =" openDialog('bounce')" >Bounce</UIExamplesButton >
5+ </template >
6+
7+ <script setup>
8+ import {inject } from ' vue'
9+ import {injectionKey } from " ../../../src/plugin/index.ts" ;
10+
11+ defineOptions ({
12+ name: " OptionsExampleAnimation"
13+ })
14+
15+ const $dialog = inject (injectionKey)
16+ const openDialog = (animation ) => $dialog .alert ({
17+ title: ' Alert example' ,
18+ body: ' Session expired. Please login again to continue.' ,
19+ }, {
20+ okText: ' Dismiss' ,
21+ animation,
22+ backdropClose: true ,
23+ })
24+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <UIExamplesButton @click =" openDialog()" >Show dialog</UIExamplesButton >
3+ </template >
4+
5+ <script setup>
6+ import {inject } from ' vue'
7+ import {injectionKey } from " ../../../src/plugin/index.ts" ;
8+
9+ defineOptions ({
10+ name: " OptionsExampleLoader"
11+ })
12+
13+ const $dialog = inject (injectionKey)
14+ const openDialog = () => $dialog .confirm ({
15+ title: ' Confirmation!' ,
16+ body: ' Delete is permanent. Do you wish to proceed?' ,
17+ }, {
18+ okText: ' Delete' ,
19+ loader: true ,
20+ }).then (({ canceled, close }) => {
21+ if (canceled) return
22+ setTimeout (close, 2000 )
23+ })
24+ </script >
Original file line number Diff line number Diff line change 11# Digging deeper
22
33## Options
4- ### Custom Class
5- ### loader
4+
5+ ``` typescript
6+ declare interface DialogOptions {
7+ message: MessageWithTitle ;
8+ html: boolean ;
9+ loader: boolean ;
10+ reverse: boolean ;
11+ backdropClose: boolean ;
12+ okText: string ;
13+ cancelText: string ;
14+ type: ConfirmTypeEnum ;
15+ clicksCount: number ;
16+ animation: ' zoom' | ' bounce' | ' fade' ;
17+ customClass: {
18+ [k : string ]: string ;
19+ };
20+ verification: string ;
21+ verificationHelp: string ;
22+ promptHelp: string ;
23+ }
24+ ```
25+
26+ ### Animation
27+ There are three options to choose from so you have some flexibility with how the dialog transitions into view.
28+
29+ <UIExamplesWrapper ><OptionsExampleAnimation /></UIExamplesWrapper >
30+ @[ code] ( components/examples/OptionsExampleAnimation.vue )
31+
32+
33+ ### Loader
34+ You may use the loader option to indicate that an asynchronous task is being performed after the user decides to proceed.
35+ <UIExamplesWrapper ><OptionsExampleLoader /></UIExamplesWrapper >
36+ @[ code] ( components/examples/OptionsExampleLoader.vue )
37+
38+
39+
640
741## Custom component
42+ // Todo
843
Original file line number Diff line number Diff line change 1- # Features
1+ # Basic Features
22
33[[ toc]]
44
You can’t perform that action at this time.
0 commit comments