Skip to content

Commit 6935aff

Browse files
alexdee2007rstoenescu
authored andcommitted
Feat: Add props okLabel and cancelLabel to QDialog (quasarframework#1154)
* Update QDialog.js Add props okLabel and cancelLabel * Update QDialog.js
1 parent f21cfb8 commit 6935aff

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/components/dialog/QDialog.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default {
1414
prompt: Object,
1515
options: Object,
1616
ok: {
17-
type: Boolean,
17+
type: [String, Boolean],
1818
default: true
1919
},
20-
cancel: Boolean,
20+
cancel: [String, Boolean],
2121
stackButtons: Boolean,
2222
preventClose: Boolean,
2323
position: String,
@@ -107,6 +107,16 @@ export default {
107107
computed: {
108108
hasForm () {
109109
return this.prompt || this.options
110+
},
111+
okLabel () {
112+
return this.ok === true
113+
? 'OK'
114+
: this.ok
115+
},
116+
cancelLabel () {
117+
return this.cancel === true
118+
? 'Cancel'
119+
: this.cancel
110120
}
111121
},
112122
methods: {
@@ -187,13 +197,13 @@ export default {
187197

188198
if (this.cancel) {
189199
child.push(h(QBtn, {
190-
props: { color: this.color, flat: true, label: 'Cancel' },
200+
props: { color: this.color, flat: true, label: this.cancelLabel },
191201
on: { click: this.__onCancel }
192202
}))
193203
}
194204
if (this.ok) {
195205
child.push(h(QBtn, {
196-
props: { color: this.color, flat: true, label: 'OK' },
206+
props: { color: this.color, flat: true, label: this.okLabel },
197207
on: { click: this.__onOk }
198208
}))
199209
}

0 commit comments

Comments
 (0)