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.
@@ -82,7 +82,9 @@
82
82
  >
83
83
  </el-tab-pane>
84
84
  </el-tabs>
85
- <router-view :key="$route.fullPath"></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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.5.96",
3
+ "version": "0.5.97",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",