This repository was archived by the owner on Jan 9, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +37
-54
lines changed Expand file tree Collapse file tree 4 files changed +37
-54
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <StyledDialog v- model =" model" />
3
+ <slot : model =" model" :input = " onInput " />
4
4
5
- <Btn @click =" open " >
6
- Styled
5
+ <Btn @click =" onInput(true) " >
6
+ {{ label }}
7
7
</Btn >
8
8
</div >
9
9
</template >
10
10
11
11
<script lang="ts">
12
12
import { ref } from ' vue'
13
-
14
13
import Btn from ' @/components/UI/Btn/Btn.vue'
15
- import StyledDialog from ' ./StyledDialog.vue'
16
14
17
15
export default {
18
- name: ' StyledDialogWrapper ' ,
16
+ name: ' DialogStateWrapper ' ,
19
17
components: {
20
18
Btn ,
21
- StyledDialog ,
19
+ },
20
+
21
+ props: {
22
+ label: {
23
+ type: String ,
24
+ required: true ,
25
+ },
22
26
},
23
27
24
28
setup() {
25
29
const model = ref (false )
26
30
27
- const open = () => {
28
- model .value = true
31
+ const onInput = (value : boolean ) => {
32
+ model .value = value
29
33
}
30
34
31
35
return {
32
36
model ,
33
- open ,
37
+ onInput ,
34
38
}
35
39
},
36
40
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ export default defineComponent({
44
44
},
45
45
},
46
46
47
+ emits: [' update:modelValue' ],
48
+
47
49
setup(props , { emit }) {
48
50
const value = useModelWrapper (props , emit )
49
51
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" flex wrap" >
3
- <BaseDialogWrapper class =" mr-3" />
4
- <StyledDialogWrapper />
3
+ <DialogStateWrapper
4
+ v-slot =" {model, input}"
5
+ label =" Base"
6
+ class =" mr-3"
7
+ >
8
+ <BaseDialog :model-value =" model" @update:model-value =" input" />
9
+ </DialogStateWrapper >
10
+
11
+ <DialogStateWrapper
12
+ v-slot =" {model, input}"
13
+ label =" Styled"
14
+ >
15
+ <StyledDialog :model-value =" model" @update:model-value =" input" />
16
+ </DialogStateWrapper >
5
17
</div >
6
18
</template >
7
19
8
20
<script lang="ts">
9
- import BaseDialogWrapper from ' @/components/Dialogs/BaseDialog/BaseDialogWrapper.vue'
10
- import StyledDialogWrapper from ' @/components/Dialogs/StyledDialog/StyledDialogWrapper.vue'
21
+ import DialogStateWrapper from ' @/components/Dialog/DialogStateWrapper.vue'
22
+ import BaseDialog from ' @/components/Dialogs/BaseDialog/BaseDialog.vue'
23
+ import StyledDialog from ' @/components/Dialogs/StyledDialog/StyledDialog.vue'
11
24
12
25
export default {
13
26
name: ' DialogLayout' ,
14
27
components: {
15
- BaseDialogWrapper ,
16
- StyledDialogWrapper ,
28
+ DialogStateWrapper ,
29
+ BaseDialog ,
30
+ StyledDialog ,
17
31
},
18
32
19
- setup() {
20
- },
33
+ setup() {},
21
34
}
22
35
</script >
You can’t perform that action at this time.
0 commit comments