Put some getters function in their scope

Former-commit-id: c8e24ec73146144c4d3405f794b012b492a3aa9d [formerly a505f8f7a4ea151ccc0c116fa6df9719528905d1] [formerly f9cff4e146404428d4b811f66634ce1181b89831 [formerly f0e9b2a633]]
Former-commit-id: e8c459cd608a54e2ce355d173a6639d28a4c097e [formerly b0a78e53c5ac56cd30a90c55f09aa45034e6b808]
Former-commit-id: 1e3f803e9bdc5df044a2a8cf9b97dc25235b20bc
pull/726/head
Henrique Dias 2017-07-04 09:01:27 +01:00
parent 7bf46bfd32
commit 10c336f6d6
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
}