This repository was archived by the owner on Sep 3, 2024. It is now read-only.
File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 14
14
>
15
15
<slot :item="item" :index="index"> {{ index }}. {{ item }} </slot>
16
16
</div>
17
+ <slot name="empty" v-if="items.length <= 0">Empty</slot>
17
18
</div>
18
19
</template>
19
20
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export default defineComponent({
61
61
props: {
62
62
modelValue: {
63
63
type: Boolean,
64
+ default: false,
64
65
},
65
66
title: {
66
67
type: String,
@@ -124,19 +125,38 @@ export default defineComponent({
124
125
this.doCancel("escape")
125
126
}
126
127
},
128
+ doFocus() {
129
+ this.$nextTick(() => {
130
+ let el = this.$el.querySelector(".focus")
131
+ console.log("FOCUS", this.$el)
132
+ if (el) {
133
+ el.focus()
134
+ }
135
+ })
136
+ },
127
137
},
128
138
created() {
129
139
document?.addEventListener("keyup", this.keyPress)
130
140
},
131
141
watch: {
132
- modelValue(value) {
142
+ async modelValue(value) {
143
+ console.log("modal", this.modalValue)
133
144
if (value === true) {
134
145
this.$emit("didopen")
146
+ this.doFocus()
135
147
} else {
136
148
this.$emit("willclose")
137
149
}
138
150
},
139
151
},
152
+ // mounted() {
153
+ // this.$nextTick(() => {
154
+ // console.log("mounted", this.modalValue)
155
+ // if (this.modalValue) {
156
+ // this.doFocus()
157
+ // }
158
+ // })
159
+ // },
140
160
beforeMount() {
141
161
// Insert the Dialog component in the element container
142
162
if (this.standalone && typeof window !== "undefined") {
You can’t perform that action at this time.
0 commit comments