Skip to content

Commit 21c5300

Browse files
committed
Nested dialogs improved.
1 parent 3402bdc commit 21c5300

File tree

8 files changed

+24
-1812
lines changed

8 files changed

+24
-1812
lines changed

dist/vuejs-dialog.min.js

+2-782
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuejs-dialog.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/app.main.css

+1-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>VueJs Plugin usage example</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="css/app.main.css?06df0649f688632b3128" rel="stylesheet"></head>
7+
<link href="css/app.main.css?5c9f92a9e6063d2515ef" rel="stylesheet"></head>
88
<body>
99

1010
<div id="app"></div>
@@ -21,5 +21,5 @@
2121
ga('send', 'pageview');
2222

2323
</script>
24-
<script type="text/javascript" src="js/app.main.js?06df0649f688632b3128"></script></body>
24+
<script type="text/javascript" src="js/app.main.js?5c9f92a9e6063d2515ef"></script></body>
2525
</html>

docs/js/app.main.js

+1-182
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/vuejs-dialog.min.js

+2-782
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugin/components/dialog-window.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
if (this.canceled){
153153
this.options.promiseRejecter(false)
154154
}
155-
console.log('emit close: ', this.options.id)
155+
156156
this.$emit('close', this.options.id)
157157
},
158158
escapeKeyListener(e) {

src/plugin/components/dialog.vue

+14-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<dialog-window v-for="dialog in dialogs"
3+
<dialog-window v-for="dialog in dialogsARR"
44
:options="dialog"
55
:key="dialog.id"
66
@close="closeDialog">
@@ -9,38 +9,30 @@
99
</template>
1010

1111
<script>
12-
import Vue from 'vue'
1312
import DialogWindow from './dialog-window.vue'
1413
1514
export default {
1615
data: function () {
1716
return {
18-
dialogsOBJ: {}
19-
}
20-
},
21-
computed: {
22-
dialogs(){
23-
let ret = []
24-
for(let dialog in this.dialogsOBJ){
25-
if(this.dialogsOBJ.hasOwnProperty(dialog)){
26-
console.log("Computed: ", dialog, this.dialogsOBJ[dialog])
27-
ret.push(this.dialogsOBJ[dialog])
28-
}
29-
}
30-
return ret
17+
dialogsARR: []
3118
}
3219
},
3320
methods: {
3421
commit(data){
35-
this.$set(this.dialogsOBJ, data.id, data)
22+
this.dialogsARR.push(data)
3623
},
37-
closeDialog(id){
38-
console.log(id)
39-
40-
this.$delete(this.dialogsOBJ, id)
41-
42-
console.log(this.dialogs.length, this.dialogs)
24+
closeDialog(dialogId){
25+
let dialogIndex = null
26+
for(let i=0; i < this.dialogsARR.length; i++){
27+
if(this.dialogsARR[i].id === dialogId){
28+
dialogIndex = i
29+
break
30+
}
31+
}
4332
33+
if(dialogIndex !== null) {
34+
this.$delete(this.dialogsARR, dialogIndex)
35+
}
4436
}
4537
},
4638
components: {DialogWindow}

0 commit comments

Comments
 (0)