饿包子
饿包子
  • 发布:2021-03-17 17:58
  • 更新:2021-03-18 14:22
  • 阅读:385

运行到浏览器可以触发@input,但是打包后就不会触发

分类:uni-app
<template>  
    <view class="container">  

        <view class="field" ref="domes">  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr1"  @input="asdsada" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr[0]" focus ref="text1"  @input="changes('text2')" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr[1]" ref="text2" @input="changes('text2')" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr[2]" ref="text3" @input="changes('text3')" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr[3]" ref="text4" @input="changes('text4')" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  
            <view class="field_item">  
                <view class="field_label">库位:</view>  
                <view class="field_con">  
                    <input v-model="arr[4]" ref="text5" @input="changes('text5')" class="field_input" type="text" placeholder="请扫码">  
                </view>  
            </view>  

            <view class="field_item">  
                <view class="field_label">上架数量:</view>  
                <view class="field_con">  
                    <uni-number-box @change="changeNum" :value="number"></uni-number-box>  
                </view>  
            </view>  
        </view>  

    </view>  
</template>  
<script>  
export default {  
    data() {  
        return {  
            demo:['text1','text2','text3','text4','text5'],  
            arr:[],  
            arr1:"",  
            formData: {  
                quantity:this.num,  
            },  
        }  
    },  
    computed:{  
        number:function(){  
            let num=0  
            this.arr.forEach(function(data){  
                let value=data.trim()  
                if(value){num++}  
            })  
            console.log(num)  
            return num  
        }  
    },  
    methods: {  
        asdsada(){  
            alert(123)  
            console.log(111)  
        },  
        changes(text){  
            alert(1)  
            const array=this.demo  
            let index=array.indexOf(text)  
            if(index>=0 && index<array.length){  
                if(index==array.length-1){  
                    this.$refs[text].$el.querySelector('input').blur()  
                }else{  
                    let key=array[index+1]  
                    this.$refs[key].$el.querySelector('input').focus()  
                }  
            }  
            this.formData.text=1  
        },  

        changeNum(value){  
            this.formData.quantity = value;  
        },  
    }  
}  
</script>  
<style lang="scss">  
.container{  
    padding-bottom: 90rpx;  
}  
.field_img{  
    width: 100%;  
    height: 90px;;  
}  
.icon-saoma{  
    position: absolute;  
    top: 0;  
    right: 0;  
    width: 50rpx;  
    line-height: 50rpx;  
    font-size: 40rpx;  
    font-weight: bold;  
}  
</style>
2021-03-17 17:58 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

打包说的是 h5 吗?

该问题目前已经被锁定, 无法添加新回复