Open MuratDemirel opened 2 years ago
Better than before, but defining on settings or having callbacks would great..
data(){
return{
foldersLoaded: false
}
},
watch:{
'$store.state.fm.tree.directories': function(directories){
if(!this.foldersLoaded && directories.length){
this.foldersLoaded = true
this.setPath()
}else if(this.foldersLoaded && !directories.length){
this.foldersLoaded = false
}
}
},
methods:{
setImg(input){
this.$bvModal.show('modal-fm')
this.$store.commit('fm/setFileCallBack', url => {
this.formData[input] = url
this.$bvModal.hide('modal-fm')
});
},
setPath(){
this.$store.commit('fm/left/setSelectedDirectory', 'files/faq')
this.$store.commit('fm/left/addToHistory', 'files/faq')
this.$store.dispatch('fm/tree/reopenPath', 'files/faq')
this.$store.dispatch(`fm/left/selectDirectory`, { path:'files/faq', history: true })
}
}
I need to set path according view. This code works, but is there any better way?
Vue@2 vue-laravel-file-manager@2.5.3