feat: Upload no uploadId need to next to files page.

This commit is contained in:
chiayin
2024-01-08 12:56:34 +08:00
parent 080eb6ae95
commit 01d712e487
3 changed files with 13 additions and 7 deletions

View File

@@ -293,7 +293,6 @@ export default {
},
},
mounted() {
// 要有 uploadID 才能進來
// 只監聽第一次
let unwatch = this.$watch('fileName', (newValue) => {
if (newValue) {
@@ -307,7 +306,7 @@ export default {
);
this.isInform = true; // 初始為藍字提示
this.showEdit = true;
this.filesStore.getUploadDetail();
if(this.uploadId) this.filesStore.getUploadDetail();
unwatch();
this.isLoading = false;
},
@@ -315,7 +314,16 @@ export default {
// 離開頁面要刪 uploadID
this.uploadId = null;
this.uploadFileName = null;
}
},
beforeRouteEnter(to, from, next){
// 要有 uploadID 才能進來
next(vm => {
if(vm.uploadId == null) {
vm.$router.push({name: 'Files', replace: true});
vm.$toast.default('Please upload your file.', {position: 'bottom'});
return
}
})
},
}
// beforeRouteUpdate(){}
</script>