@@ -24,13 +24,12 @@ import { ModalsContainer } from 'vue-final-modal'
24
24
## Usage
25
25
26
26
``` ts
27
- import { markRaw } from ' vue'
28
27
import { VueFinalModal , useModal } from ' vue-final-modal'
29
28
30
29
const modalInstance = useModal <
31
30
InstanceType < typeof VueFinalModal > [' $props' ]
32
31
> ({
33
- component: markRaw ( VueFinalModal ) ,
32
+ component: VueFinalModal ,
34
33
attrs: {
35
34
// Props
36
35
displayDirective: ' if' ,
@@ -43,7 +42,7 @@ const modalInstance = useModal<
43
42
onClosed() { /* on closed */ },
44
43
},
45
44
slots: {
46
- defaults : ' <p>The content of the modal</p>'
45
+ default : ' <p>The content of the modal</p>'
47
46
}
48
47
})
49
48
@@ -90,20 +89,19 @@ You have to manually calling `modalInstance.destroy()`{lang=ts} whenever you no
90
89
- Then you can using ` useModal() ` {lang=ts} everywhere by given the same ` vfm ` instance to ` options.context ` {lang=ts}:
91
90
``` ts
92
91
// Anywhere outside out script setup
93
- import { markRaw } from ' vue'
94
92
import { VueFinalModal , useModal } from ' vue-final-modal'
95
93
import { vfm } from ' @/plugins/vue-final-modal'
96
94
97
95
export function openConfirmModal() {
98
96
const modalInstance = useModal ({
99
97
context: vfm ,
100
- component: markRaw ( MyConfirmModal ) ,
98
+ component: MyConfirmModal ,
101
99
attrs: {
102
100
onClosed() {
103
101
modalInstance .destroy ()
104
102
},
105
103
},
106
- slots: { defaults : ' <p>The content of the modal</p>' }
104
+ slots: { default : ' <p>The content of the modal</p>' }
107
105
})
108
106
109
107
modalInstance .open ()
@@ -126,20 +124,19 @@ You have to manually calling `modalInstance.destroy()`{lang=ts} whenever you no
126
124
- Then you can using ` useModal() ` {lang=ts} everywhere by given the same ` vfm ` instance to ` options.context ` {lang=ts}:
127
125
``` ts
128
126
// Anywhere outside out script setup
129
- import { markRaw } from ' vue'
130
127
import { VueFinalModal , useModal } from ' vue-final-modal'
131
128
import { vfm } from ' @/plugins/vue-final-modal'
132
129
133
130
export function openConfirmModal() {
134
131
const modalInstance = useModal ({
135
132
context: vfm ,
136
- component: markRaw ( MyConfirmModal ) ,
133
+ component: MyConfirmModal ,
137
134
attrs: {
138
135
onClosed() {
139
136
modalInstance .destroy ()
140
137
},
141
138
},
142
- slots: { defaults : ' <p>The content of the modal</p>' }
139
+ slots: { default : ' <p>The content of the modal</p>' }
143
140
})
144
141
145
142
modalInstance .open ()
0 commit comments