Dialog enhancement
-
Hi,
It is difficult to access the Vue object (this) from the Dialog object. It will be good to pass this object to the .create() implicitly. So simple things can be achievable much easier:
…
methods: {
about () {
Dialog.create({
title: ‘About’,
message: ‘Some about message’,
onDismiss (caller) {
caller.$refs.menu.close()
}
})
}
…Rus
-
Use ES6 at its max:
methods: {
about () {
Dialog.create({
title: ‘About’,
message: ‘Some about message’,
onDismiss: () => { // <<<<<<<<
this.$refs.menu.close() // <<<<<<<
}
})
}You can read about arrow functions and pay close attention to closures.
-
Wow ! Thanks ! It works now