从元素中以编程方式删除 v-on:click 事件 (VueJs)

Remove v-on:click event programmatically from an element (VueJs)

如何从 div 中删除 v-on:click 事件?

<div v-on:click="RegistroT(1)" class="btn btn-secondary btn-block" 
         :disabled="HoraIngreso !== '00:00'">
     <i class="fa fa-clock-o"></i> 
     <span id="TxtHoraIngreso" v-text="HoraIngreso"></span>
</div>

我在从 VueJS 方法 created 调用的函数中尝试了此操作,当检索数据时(从 JsonResult):

$('#TxtHoraIngreso').parent().addClass(this.HoraIngreso !== '00:00' ? 'disabled' : '');

但是不行。

基本上,当用户注册他的进入时间时,他下次进入网络时必须停用该按钮。

<template>
    <div class="button-wrapper">
        <button class="btn btn-secondary btn-block" :class="{'disabled': isDisabled}" @click="someMethodName"></button>
    </div>
</template>

<script>
export default 
{
    data()
    {
        return {
            isDisabled: false
        }
    },
    methods:
    {
        someMethodName()
        {
            setTimeout(() => {
                this.isDisabled = true;
            }, 3600);
        }
    }
}
</script>

但也许我没理解你的问题 ;>

How do I remove the v-on:click event from a div?

一种简单的方法是仅在状态有效时调用事件处理程序。

<button
  type="button"
  v-on:click="e => valid && onClickSubmit()"
>
  Sign Up
</button>

onClickSubmit()只有在valid = true

时才会执行