File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/views/component_built_in_example Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -138,17 +138,25 @@ function showModalPromiseConfirm() {
138138}
139139
140140const TestComponent = defineComponent ({
141- setup() {
141+ props: {
142+ close: {
143+ type: Function ,
144+ },
145+ },
146+ setup(props ) {
142147 const val = ref (' 123' )
143148 return () => (
144- <div >
149+ <div class = " flex flex-col gap-4 " >
145150 <input v-model = { val .value } class = " w-full border rounded-md p-2" />
151+ <fa-button onClick = { () => props .close ?.()} >
152+ 组件内部关闭弹窗
153+ </fa-button >
146154 </div >
147155 )
148156 },
149157})
150158
151- const { open : open2 } = useFaModal ().create ({
159+ const { open : open2, close : close2 } = useFaModal ().create ({
152160 title: ' 标题' ,
153161 description: ' 这里是一段描述介绍' ,
154162 beforeClose : (action , done ) => {
@@ -165,7 +173,9 @@ const { open: open2 } = useFaModal().create({
165173 done ()
166174 }
167175 },
168- content: h (TestComponent ),
176+ content: h (TestComponent , {
177+ close : () => close2 (),
178+ }),
169179})
170180 </script >
171181
You can’t perform that action at this time.
0 commit comments