Skip to content

Commit 2043bee

Browse files
committed
Add DialogTab
1 parent 49ef374 commit 2043bee

35 files changed

+1273
-605
lines changed

dist/MarkdownPalettes.common.js

Lines changed: 363 additions & 223 deletions
Large diffs are not rendered by default.

dist/MarkdownPalettes.common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/MarkdownPalettes.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/MarkdownPalettes.esm.js

Lines changed: 348 additions & 84 deletions
Large diffs are not rendered by default.

dist/MarkdownPalettes.umd.js

Lines changed: 363 additions & 223 deletions
Large diffs are not rendered by default.

dist/MarkdownPalettes.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/MarkdownPalettes.umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/markdown-palettes.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Dialog/Dialog.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
</div>
1111

1212
<form class="mp-dialog-body" @submit.prevent="finish">
13-
<dialog-form :fields="this.request.body" v-model="responseData"></dialog-form>
13+
<dialog-form v-if="this.request.type === 'form'" :fields="this.request.body" v-model="responseData"></dialog-form>
14+
<dialog-tab v-else-if="this.request.type === 'tab'" :fields="this.request.body" v-model="responseData"></dialog-tab>
1415

1516
<div class="mp-dialog-footer">
1617
<div>
@@ -106,6 +107,7 @@
106107

107108
<script>
108109
import DialogForm from './DialogForm.vue'
110+
import DialogTab from './DialogTab.vue'
109111
110112
export default {
111113
name: 'editor-dialog',
@@ -117,8 +119,12 @@ export default {
117119
},
118120
data () {
119121
const initialData = {}
120-
this.request.body.forEach(function (field) {
121-
initialData[field.name] = field.default ? field.default : ''
122+
this.request.body.forEach((field) => {
123+
if (this.request.type === 'form') {
124+
initialData[field.name] = field.default ? field.default : ''
125+
} else if (this.request.type === 'tab') {
126+
initialData[field.name] = {}
127+
}
122128
})
123129
return {
124130
responseData: initialData
@@ -137,7 +143,7 @@ export default {
137143
this.$emit('finish', this.response)
138144
}
139145
},
140-
components: { DialogForm },
146+
components: { DialogForm, DialogTab },
141147
inject: ['t']
142148
}
143149
</script>

src/components/Dialog/DialogForm.vue

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<script>
10-
import DialogComponents from './DialogComponentMap'
10+
import DialogComponents from './FormComponent/DialogFormComponentMap'
1111
1212
export default {
1313
name: 'dialog-form',
@@ -25,22 +25,22 @@ export default {
2525
prop: 'value',
2626
event: 'change'
2727
},
28-
computed: {
29-
data: {
30-
get () {
31-
return this.value
32-
},
33-
set (value) {
34-
this.$emit('change', value)
35-
}
28+
data () {
29+
const initialData = {}
30+
this.fields.forEach((field) => {
31+
initialData[field.name] = field.default ? field.default : ''
32+
})
33+
return {
34+
selectId: 1,
35+
data: initialData
3636
}
3737
},
38-
methods: {
39-
close () {
40-
this.$emit('close')
41-
},
42-
finish () {
43-
this.$emit('finish', this.response)
38+
watch: {
39+
data: {
40+
deep: true,
41+
callback (newData) {
42+
this.$emit('change', newData)
43+
}
4444
}
4545
},
4646
components: DialogComponents,

0 commit comments

Comments
 (0)