单击禁用的按钮时,是否可以触发此特定功能?然后启用按钮后触发其他功能?
我试图做这样的骇客,但没有成功
<template>
<b-form @submit.prevent="game">
<b-row
class="mt-4"
v-on:click="invalid ? hello : ''"
>
<b-button
class="auth-button"
pill
:disabled="invalid"
type="submit"
>
重置密碼
</b-button>
</b-row>
</b-form>
</template>
<script>
data: function() {
return {
invalid: true
};
},
methods: {
hello() {
alert('Hello World')
}
game() {
alert('Game Over')
}
}
</script>
答案 0 :(得分:0)
There is no way to capture a click on disabled elements. Your best bet is to react to a specific class on the element.
HTML Markup:
<input type="button" class="disabled" value="click" />
JavaScript code:
$('input').click(function (event) {
if ($(this).hasClass('disabled')) {
alert('CLICKED, BUT DISABLED!!');
} else {
alert('Not disabled. =)');
}
});