leisure-core 0.5.96 → 0.5.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/le-home/src/main.vue +21 -1
- package/package.json +1 -1
package/le-home/src/main.vue
CHANGED
|
@@ -82,7 +82,9 @@
|
|
|
82
82
|
>
|
|
83
83
|
</el-tab-pane>
|
|
84
84
|
</el-tabs>
|
|
85
|
-
<router-view
|
|
85
|
+
<router-view
|
|
86
|
+
:key="refreshKey.toString() + $route.fullPath"
|
|
87
|
+
></router-view>
|
|
86
88
|
</div>
|
|
87
89
|
</el-main>
|
|
88
90
|
</el-container>
|
|
@@ -226,6 +228,7 @@ export default {
|
|
|
226
228
|
menuLeft: 0,
|
|
227
229
|
menuTop: 0,
|
|
228
230
|
pwdinfo: "",
|
|
231
|
+
refreshKey: 0,
|
|
229
232
|
};
|
|
230
233
|
},
|
|
231
234
|
mounted() {
|
|
@@ -263,7 +266,9 @@ export default {
|
|
|
263
266
|
return item;
|
|
264
267
|
});
|
|
265
268
|
this.$emit("homeInit");
|
|
269
|
+
document.addEventListener("keydown", this.handleKeyDown);
|
|
266
270
|
},
|
|
271
|
+
|
|
267
272
|
watch: {
|
|
268
273
|
contextMenuVisible() {
|
|
269
274
|
if (this.contextMenuVisible) {
|
|
@@ -273,7 +278,22 @@ export default {
|
|
|
273
278
|
}
|
|
274
279
|
},
|
|
275
280
|
},
|
|
281
|
+
beforeDestroy() {
|
|
282
|
+
document.removeEventListener("keydown", this.handleKeyDown);
|
|
283
|
+
},
|
|
276
284
|
methods: {
|
|
285
|
+
handleKeyDown(e) {
|
|
286
|
+
// F5 键的 keyCode 是 116
|
|
287
|
+
if (e.keyCode === 116) {
|
|
288
|
+
e.preventDefault(); // 阻止默认刷新行为
|
|
289
|
+
this.refreshView();
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
refreshView() {
|
|
293
|
+
this.refreshKey++;
|
|
294
|
+
// 可以添加一些视觉反馈
|
|
295
|
+
this.$message.success("数据已刷新");
|
|
296
|
+
},
|
|
277
297
|
openContextMenu(e) {
|
|
278
298
|
e.preventDefault(); //防止默认菜单弹出
|
|
279
299
|
this.contextMenuVisible = true;
|