Put some getters function in their scope

pull/144/head
Henrique Dias 2017-07-04 09:01:27 +01:00
parent ae28c3cfa9
commit f0e9b2a633
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 10 additions and 21 deletions

View File

@ -22,7 +22,7 @@ import Download from './Download'
import Move from './Move'
import NewFile from './NewFile'
import NewDir from './NewDir'
import {mapGetters, mapState} from 'vuex'
import {mapState} from 'vuex'
export default {
name: 'prompts',
@ -38,17 +38,15 @@ export default {
},
computed: {
...mapState(['prompt']),
...mapGetters([
'showOverlay',
'showInfo',
'showHelp',
'showDelete',
'showRename',
'showMove',
'showNewFile',
'showNewDir',
'showDownload'
])
showInfo: function () { return this.prompt === 'info' },
showHelp: function () { return this.prompt === 'help' },
showDelete: function () { return this.prompt === 'delete' },
showRename: function () { return this.prompt === 'rename' },
showMove: function () { return this.prompt === 'move' },
showNewFile: function () { return this.prompt === 'newFile' },
showNewDir: function () { return this.prompt === 'newDir' },
showDownload: function () { return this.prompt === 'download' },
showOverlay: function () { return this.prompt !== null }
},
methods: {
resetPrompts () {

View File

@ -1,13 +1,4 @@
const getters = {
showInfo: state => (state.prompt === 'info'),
showHelp: state => (state.prompt === 'help'),
showDelete: state => (state.prompt === 'delete'),
showRename: state => (state.prompt === 'rename'),
showMove: state => (state.prompt === 'move'),
showNewFile: state => (state.prompt === 'newFile'),
showNewDir: state => (state.prompt === 'newDir'),
showDownload: state => (state.prompt === 'download'),
showOverlay: state => (state.prompt !== null),
selectedCount: state => state.selected.length
}