账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    weex 的 input 组件中的blur和focus函数无法调用?
    68
    0

    问题

    无法调用weex的input组件中的blur和focus 函数。 但我调用input的blur(focus)函数时,键盘并没有被收起,此时查看Android studio 打印的日志提示一下错误

    12-01 16:13:30.791 32201-32214/com.example.zhangshijie.myapplication E/jsengine:  ReportException :undefined:5: TypeError: Object [object Object] has no method 'blur'
    12-01 16:13:30.802 32201-32214/com.example.zhangshijie.myapplication E/jsengine:  ReportException : TypeError: Object [object Object] has no method 'blur'
                                                                                         at t.default.methods.click (eval at Jt ((weex):4:2004), <anonymous>:5:632)
                                                                                         at Object.n [as fn] ((weex):3:3068)
                                                                                         at null.<anonymous> ((weex):3:10683)
                                                                                         at L.Object.assign.fireEvent ((weex):2:29647)
                                                                                         at G.Object.assign.fireEvent ((weex):3:886)
                                                                                         at (weex):4:488
                                                                                         at Array.forEach (native)
                                                                                         at Object.Ft [as receiveTasks] ((weex):4:384)
                                                                                         at Object.M.tu.(anonymous function) [as callJS] ((weex):1:8334)
                                                                                         at global.(anonymous function) ((weex):7:1148)
    12-01 16:13:30.802 32201-32214/com.example.zhangshijie.myapplication E/weex: reportJSException >>>> instanceId:1, exception function:callJS, exception:TypeError: Object [object Object] has no method 'blur'
    

    下面是我的.vue 文件内容

    <template>
      <div @click="click" class="bounds">
          <input ref = "inputMessage" class= "input" type="text" value="测试数据"></input>
      </div>
    </template>
    
    <style scoped>
    
    .input {
        top: 100;
        width: 600;
        left: 50;
        height: 100;
        background-color: red
    }
    .bounds {
        position: absolute;
        top: 0;
        left: 0;
        width: 750;
        background-color: green
    }
    </style>
    
    
    <script>
    export default {
        methods: {
            click: function(e) {
                this.$refs.inputMessage.blur()
                // console.log('this.refs', this.refs)
            }
        }
    }
    </script>
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • KYIK爱你 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部