Browse Source

Loading: keep loading text sync with element-loading-text attribute #2272

imyzf 8 years ago
parent
commit
e467da0722
2 changed files with 4 additions and 0 deletions
  1. 1 0
      packages/loading/src/directive.js
  2. 3 0
      packages/loading/src/loading.vue

+ 1 - 0
packages/loading/src/directive.js

@@ -91,6 +91,7 @@ exports.install = Vue => {
 
     update: function(el, binding) {
       if (binding.oldValue !== binding.value) {
+        el.instance.setText(el.getAttribute('element-loading-text'));
         toggleLoading(el, binding);
       }
     },

+ 3 - 0
packages/loading/src/loading.vue

@@ -28,6 +28,9 @@
     methods: {
       handleAfterLeave() {
         this.$emit('after-leave');
+      },
+      setText(text) {
+        this.text = text;
       }
     }
   };