@input绑定两个方法

@input.native="getRatio,value=value.replace(/1/g, '')"
为什么这样写getRatio方法不执行呢


  1. \d.
阅读 2.6k
2 个回答

element-ui中@input只接一个方法,应该可以使用箭头函数。

@input.native = '() => {
    this.getRatio()
    value=value.replace(/[1](https://segmentfault.com/q/1010000039187289#fn-1)/g, '')
}'
@input.native="getRatio(); value=value.replace(/[1](https://segmentfault.com/q/1010000039187289#fn-1)/g, '')"

分号分割, 模板中接受一个js表达式

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题