Is there a way to modify the code so that the function triggers with just one click instead of two?
export default {
methods: {
remove(){
$('.remove-me button').click( function() {
removeItem(this);
});
function removeItem(removeButton) {
var productRow = $(removeButton).parent().parent();
productRow.slideUp(fadeTime, function() {
productRow.remove();
recalculateCart();
});
}
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<template>
<div class="remove-me">
<button type="button" @click="remove">Remove</button>
</div>
</template>