toggle-components-library 1.17.0 → 1.18.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -74,7 +74,29 @@ export default {
74
74
  return this.buttonStyle.includes('mini');
75
75
  }
76
76
  },
77
+ watch: {
78
+ disabled() {
79
+ if (this.$slots.default !== undefined){
80
+ this.disableLinks()
81
+ }
82
+ },
83
+ loading() {
84
+ if (this.$slots.default !== undefined){
85
+ this.disableLinks()
86
+ }
87
+ }
88
+ },
77
89
  methods: {
90
+
91
+ /**
92
+ * set link href to null if button loading or disabled
93
+ */
94
+ disableLinks() {
95
+ this.$slots.default.forEach(slot => {
96
+ slot.data.attrs.href = this.disabled || this.loading ? null : slot.data.attrs.href;
97
+ })
98
+ },
99
+
78
100
  click(){
79
101
  /**
80
102
  * Emitted when the button is clicked.
@@ -83,6 +105,11 @@ export default {
83
105
  */
84
106
  this.$emit('click');
85
107
  }
108
+ },
109
+ created() {
110
+ if (this.$slots.default !== undefined){
111
+ this.disableLinks()
112
+ }
86
113
  }
87
114
  }
88
115
  </script>