点击扫码,弹出窗体
 
                                        
                                    
                                    - 发布:2023-11-22 09:04
- 更新:2024-01-19 09:09
- 阅读:673
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 3.96
手机系统: Android
手机系统版本号: Android 11
手机厂商: 小米
手机机型: CIVI
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
                                    
                                         
                                
                                                                                                预期结果:
                                    
                                    
                                        弹出窗体的文本框应该默认有光标
                                     
                                
                                                                                                弹出窗体的文本框应该默认有光标
实际结果:
                                    
                                    
                                        文本框弹出软键盘,没有光标
                                     
                                
                                                            文本框弹出软键盘,没有光标
bug描述:
本地调试input focus会触发光标,云打包之后,input会弹出软键盘没有光标。导致使用PDA客户扫码时,扫不出来,要点击一下文本框才行。用过历史老版本3.5.3,3.6.4和3.7.11等多个版本皆无效,所以应该是云打包存在的问题。
已经困扰我好几个版本,也没有解决的问题,客户已经在要放弃合作的边缘了,很急
 
                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                
                                    
                                    
                                    
                                                                                                         
                                                                    
                                                                黑咖 (作者)
<template>  
    <view class="container">  
        <view class="uni-textarea">  
            <view class="uni-title">输入信息</view>  
            <view class="uni-textarea">  
                <textarea v-model="FormNo" :focus="focusState" confirm-type="search" @confirm="doSearch"/>  
            </view>  
        </view>  
        <tui-tabbar :tabBar="tabBar" :isFixed="true" :current="current" @click="tabbarSwitch"></tui-tabbar>  
    </view>  
</template>  
<script>  
    export default {  
        data() {  
            return {  
                tabBar: [{  
                        "pagePath": "/pages/tabbar/index/index",  
                        "text": "清空",  
                        "iconPath": "/static/images/tabbar/clear.png",  
                        "selectedIconPath": "/static/images/tabbar/clear.png"  
                    },  
                    {    
                        "pagePath": "/pages/tabbar/extend/extend",  
                        "text": "确认",  
                        "iconPath": "/static/images/tabbar/ok.png",  
                        "selectedIconPath": "/static/images/tabbar/ok.png"  
                    }  
                ],  
                current: 0,  
                FormNo: '',  
                focusState:false  
            }  
        },  
        onShow() {  
            this.firstChange();  
        },  
        mounted() {  
            this.focusState = false;  
            this.$nextTick(()=>{  
                this.focusState = true;  
            })  
        },  
        methods: {  
            firstChange() {  
                // this.focusState = false; // 每次都要初始化 focus 属性  
                // setTimeout(() => {  
                //  this.focusState = true; // this.secondFocus 是第二个文本框的 focus 属性。  
                // },100)  
            },  
            //键盘点击回车  
            doSearch(){  
                if(this.FormNo == "")  
                {  
                    return;  
                }  
                //显示搜索结果  
                uni.setStorageSync('InputFormNo', this.FormNo);  
                // uni.$emit('input', "文本");  
                // uni.navigateBack({});  
                this.$api.prePage().InputScanOver();  
                uni.navigateBack({});  
            },  
            tabbarSwitch(e) {  
                //获取登录状态,此处默认未登录  
                this.current = e.index;  
                //console.log(this.current);  
                switch (this.current) {  
                    case 0:  
                        //清空  
                        this.FormNo = '';  
                        break;  
                    case 1:  
                        //确认  
                        this.doSearch();  
                        break;  
                }  
            }  
        }  
    }  
</script>  
<style>  
</style>  
 
             
             
             
			 
                                                                    