Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Chrome/Safari在不同时间触发点击事件_Javascript_Vue.js_Vuejs2_Vue Component - Fatal编程技术网

Javascript Chrome/Safari在不同时间触发点击事件

Javascript Chrome/Safari在不同时间触发点击事件,javascript,vue.js,vuejs2,vue-component,Javascript,Vue.js,Vuejs2,Vue Component,我有一个Vue配方门户,在其一侧有一个过滤器,用户可以在其中选择给定的标记 <filter-button v-on:click="filterByTag()" label="selectedTags.indexOf(<%= tag %>) != -1" :isChecked="selectedTags.indexOf(<%= tag %>) != -1" ></filter-button> 此console.log(c

我有一个Vue配方门户,在其一侧有一个过滤器,用户可以在其中选择给定的标记

<filter-button 
    v-on:click="filterByTag()" 
    label="selectedTags.indexOf(<%= tag %>) != -1"
    :isChecked="selectedTags.indexOf(<%= tag %>) != -1"
></filter-button>
console.log(check_status)
调用在Chome上显示
true
,在Safari上显示
false
,从而在Safari上对Chrome进行正确过滤,并对Safari进行不正确的安装

是否有更好的方法执行此检查以确保所有浏览器的响应相同?

这是我的
过滤器按钮
组件:

<script type="text/x-template" id="filter-button">
    <div class="form-check my-3">
      <label class="form-check-label">
        <input class="form-check-input" 
            type="checkbox" 
            v-model="isChecked" 
            v-on:click="filterByTag()"
        >
        {{ tag.name }}
        <span class="form-check-sign">
            <span class="check"></span>
        </span>
        </label>
    </div>
</script>

{{tag.name}

尝试使用v-on:mouseup。这将确保已启动更改。你也可以用v-on:change

<filter-button 
    v-on:change="filterByTag()" 
    label="selectedTags.indexOf(<%= tag %>) != -1"
    :isChecked="selectedTags.indexOf(<%= tag %>) != -1"
></filter-button>

您是否尝试过e.preventDefault();在filterByTag()函数中
<filter-button 
    v-on:change="filterByTag()" 
    label="selectedTags.indexOf(<%= tag %>) != -1"
    :isChecked="selectedTags.indexOf(<%= tag %>) != -1"
></filter-button>