Przeglądaj źródła

Loading增加恢复焦点对象的功能。

yangzhijie 4 lat temu
rodzic
commit
e703251c44
2 zmienionych plików z 12 dodań i 1 usunięć
  1. 1 1
      package.json
  2. 11 0
      packages/loading/src/Loading.vue

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pc-component-v3",
-  "version": "1.0.26",
+  "version": "1.0.27",
   "description": "",
   "main": "dist/pc-component-v3.js",
   "scripts": {

+ 11 - 0
packages/loading/src/Loading.vue

@@ -41,11 +41,22 @@ export default {
 
   mounted: function () {
     var _self = this;
+    // 获取焦点对象
+    _self.activeElement = document.activeElement;
     _self.$nextTick(function () {
       _self.$refs.focusInput.focus();
     });
   },
 
+  beforeUnmount: function(){
+    var _self = this;
+    // 恢复焦点对象
+    if(_self.activeElement != null){
+      _self.activeElement.focus();
+      _self.activeElement = null;
+    }
+  },
+
 
   methods: {
     // 居中显示