diff --git a/openRenamerFront/src/App.vue b/openRenamerFront/src/App.vue index 111aaf4..6cccf5c 100644 --- a/openRenamerFront/src/App.vue +++ b/openRenamerFront/src/App.vue @@ -45,14 +45,14 @@ export default { activeIndex: location.pathname, }; }, + async beforeCreate() { + window.token = localStorage.getItem("token"); + window.isWindows = await httpUtil.get("/file/isWindows"); + }, async created() { //获取最新版本 let config = await httpUtil.get("https://s3.fleyx.com/picbed/openRenamer/config.json"); this.latestVersion = config.version; - window.token = localStorage.getItem("token"); - window.isWindows = await httpUtil.get("/file/isWindows"); - console.log(this.$route); - console.log(this.activeIndex); }, async mounted() { console.log(this.$route); diff --git a/openRenamerFront/src/views/home/Home.vue b/openRenamerFront/src/views/home/Home.vue index 79154d6..26e2006 100644 --- a/openRenamerFront/src/views/home/Home.vue +++ b/openRenamerFront/src/views/home/Home.vue @@ -22,7 +22,7 @@
- 反选 + {{ allChecked ? "不选" : "全选" }} 一键选择 @@ -120,7 +120,11 @@ export default { showNameEditDialog: false //显示编辑文件弹窗 }; }, - computed: {}, + computed: { + allChecked() { + return this.fileList.length > 0 && this.fileList.filter(item => item.checked).length === this.fileList.length; + } + }, async created() { this.savePathList = await HttpUtil.get("/file/path"); window.isWindows = await HttpUtil.get("/file/isWindows"); @@ -214,9 +218,9 @@ export default { this.showNameEditDialog = false; await this.showResult(); }, - //反选 selectAllFiles() { - this.fileList.forEach((item) => (item.checked = !item.checked)); + let checked = !this.allChecked; + this.fileList.forEach((item) => (item.checked = checked)); }, //检查规则和文件 checkRuleAndFile() {