XXXUrain
XXXUrain
  • 发布:2024-03-06 16:55
  • 更新:2024-03-07 10:18
  • 阅读:91

绑定addEventListener不生效

分类:uni-app
createTipInfoView(currentWebview) {  
                const info = new plus.nativeObj.View('info', {  
                        top: '75%',  
                        left: '0px',  
                        height: '100%',  
                        width: '100%'  
                    },  
                    [{  
                        tag: 'font',  
                        id: 'scanTips',  
                        text: "手动输入",  
                        textStyles: {  
                            size: '14px',  
                            color: '#ffffff',  
                            whiteSpace: 'normal'  
                        },  
                        position: {  
                            top: '6px',  
                            left: '10%',  
                            width: '80%',  
                            height: 'wrap_content'  
                        }  
                    }]);  
                info.interceptTouchEvent(true);           
                currentWebview.append(info);  
                info.addEventListener("click", (e) => {  
                    console.log(0);  
                }, false)  

            },

第一次写 测试点击无效 求问怎么解决

2024-03-06 16:55 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

可以添加点击事件,再试试

<template>  
    <view class="">  
        <button @click="createTipInfoView">createTipInfoView</button>  
    </view>  
</template>  
<script>  
    export default {  
        methods: {  
            createTipInfoView() {  
                const info = new plus.nativeObj.View('info', {  
                        top: '75%',  
                        left: '0px',  
                        height: '100%',  
                        width: '100%'  
                    },  
                    [{  
                        tag: 'font',  
                        id: 'scanTips',  
                        text: "手动输入",  
                        textStyles: {  
                            size: '14px',  
                            color: '#333333',  
                            whiteSpace: 'normal'  
                        },  
                        position: {  
                            top: '6px',  
                            left: '10%',  
                            width: '80%',  
                            height: 'wrap_content'  
                        }  
                    }]);  
                info.show();  
                info.addEventListener("click", (e) => {  
                    console.log('infoinfoinfo')  
                }, false);  
            }  
        }  
    }  
</script>

要回复问题请先登录注册