Skip to content

Commit

Permalink
Simplify Syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
service-paradis committed Nov 5, 2019
1 parent af7838d commit 19e1055
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 21 deletions.
4 changes: 1 addition & 3 deletions src/components/datepicker/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,7 @@ export default {
/**
* Keypress event that is bound to the document.
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
this.togglePicker(false)
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ export default {
/**
* Keypress event that is bound to the document
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (this.isActive && (key === 'Escape' || key === 'Esc')) {
if (this.cancelOptions.indexOf('escape') < 0) return
this.isActive = false
Expand Down
4 changes: 1 addition & 3 deletions src/components/loading/Loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ export default {
/**
* Keypress event that is bound to the document.
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (key === 'Escape' || key === 'Esc') this.cancel()
}
},
Expand Down
4 changes: 1 addition & 3 deletions src/components/modal/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ export default {
/**
* Keypress event that is bound to the document.
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (this.isActive && (key === 'Escape' || key === 'Esc')) this.cancel('escape')
},
Expand Down
4 changes: 1 addition & 3 deletions src/components/navbar/NavbarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export default {
/**
* Keypress event that is bound to the document
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (key === 'Escape' || key === 'Esc') {
this.$parent.closeMenu()
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/taginput/Taginput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,15 @@ export default {
}
},
keydown(event) {
const { key } = event
keydown({ key, preventDefault }) {
if (this.removeOnKeys.indexOf(key) !== -1 && !this.newTag.length) {
this.removeLastTag()
}
// Stop if is to accept select only
if (this.autocomplete && !this.allowNew) return
if (this.confirmKeys.indexOf(key) >= 0) {
event.preventDefault()
preventDefault()
this.addTag()
}
},
Expand Down
4 changes: 1 addition & 3 deletions src/utils/TimepickerMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,7 @@ export default {
/**
* Keypress event that is bound to the document.
*/
keyPress(event) {
// Esc key
const { key } = event
keyPress({ key }) {
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
this.toggle(false)
}
Expand Down

0 comments on commit 19e1055

Please sign in to comment.