- 全部文件
+ 全部文件
- {{ p.name }}
+ {{ p.name }}
{{ p.name }}
@@ -202,6 +202,12 @@ export default {
}
}
},
+ watch:{
+ '$route'(){
+ // console.log(this.$route)
+ this.handleHashChange();
+ }
+ },
computed: {
currentPathList() {
if (this.currentPath == '/') return []
@@ -220,12 +226,12 @@ export default {
components: {FileBlockItem, FileIcon, ArrowDown, Grid, FolderAdd},
mounted() {
console.log('记载所有的文件')
- window.addEventListener('popstate',()=>console.log(location.href))
- window.addEventListener('hashchange', this.handleHashChange) // 添加监听
+ // window.addEventListener('popstate',()=>console.log(location.href))
+ // window.addEventListener('hashchange', this.handleHashChange) // 添加监听
this.handleHashChange();
},
unmounted() {
- window.removeEventListener('hashchange', this.handleHashChange); // 取消监听
+ // window.removeEventListener('hashchange', this.handleHashChange); // 取消监听
},
methods: {
// 加载目录下的所有文件
@@ -242,8 +248,8 @@ export default {
},
// 获取获取当前目录路径
getCurrentPath() {
- const hash = location.hash;
- const params = qs.parse(hash.substr(2))
+ const query = this.$route.query;
+ const params = qs.parse(query)
return params.path || '/';
},
//记载所有的子文件