zoukankan      html  css  js  c++  java
  • xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

    vue stop event bug

    [Vue warn]: Error in v-on handler: "TypeError: e.prevntDefault is not a function"

    Event-Modifiers

    https://vuejs.org/v2/guide/events.html#Event-Modifiers

    
    <template>
        <!-- <div class="tools-hover-box-container" @click="clickFilter"> -->
        <div class="tools-hover-box-container" @click.prevent="clickFilter">
        <!-- <div class="tools-hover-box-container" @click.stop="clickFilter"> -->
        <!-- <div class="tools-hover-box-container" @click.stop.prevent="clickFilter"> -->
            <section class="tools-hover-box-item"
                v-for="({name, list}, i) in cardsList"
                :key="i">
                <span class="tools-hover-box-category">{{name}}</span>
                <ul class="tools-hover-box-list">
                    <li class="tools-hover-box-list-item"
                        data-hoverflag="true"
                        v-for="({icon, title, routerName}, j) in list"
                        :key="j"
                        @click.prevent="gotoRouter(routerName)">
                        <icon-svg class="item-icon-size" :icon-class="icon" />
                        <p class="item-title">{{title}}</p>
                    </li>
                </ul>
            </section>
        </div>
    </template>
    
    
    clickFilter (e) {
        console.log('e.target =', e.target, e);
        const {
            hoverflag: hoverFlag,
        } = e.target.dataset;
        // console.log('✅ e.target =', e.target, hoverFlag === undefined, typeof hoverFlag);
        if(hoverFlag !== undefined) {
            // goto
            // this.$emit('click');
            // console.log('✅ hoverFlag =', hoverFlag, typeof hoverFlag);
        } else {
            // ignore
            // console.log('❌ hoverFlag =', hoverFlag, typeof hoverFlag);
            e.prevntDefault();
            e.stopPropagation();
        }
    },
    
    

    refs



    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    冒泡排序
    数据结构和算法关系
    js获取ifram对象
    java STL
    bufferedReader 乱码问题
    css animation让图标不断旋转
    apply通过实例理解
    jquery.ajaxfileupload.js
    JDBC getMetaData将结果集组装到List
    Android开发之使用BaseAdapter的notifyDataSetChanged()无法更新列表
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/14187867.html
Copyright © 2011-2022 走看看