Commit e289e861 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Button: avoid click event bubbling when disabled

parent dc77b56d
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
} }
]" ]"
> >
<i class="el-icon-loading" v-if="loading"></i> <i class="el-icon-loading" v-if="loading" @click="handleInnerClick"></i>
<i :class="'el-icon-' + icon" v-if="icon && !loading"></i> <i :class="'el-icon-' + icon" v-if="icon && !loading" @click="handleInnerClick"></i>
<span v-if="$slots.default"><slot></slot></span> <span v-if="$slots.default" @click="handleInnerClick"><slot></slot></span>
</button> </button>
</template> </template>
<script> <script>
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
methods: { methods: {
handleClick(evt) { handleClick(evt) {
this.$emit('click', evt); this.$emit('click', evt);
},
handleInnerClick(evt) {
if (this.disabled) {
evt.stopPropagation();
}
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment