return 字符串不支持
-
问题描述
这并不是 Taro 的问题,而是支付宝没提供这种功能,限定某个组件查询节点 类似于 微信小程序的 in 语法 或者说是 react 的 this.ref 的方式,这对于组件化是一个很重要的功能,缺少这个功能将导致 组件中使用节点查询的结果 永远都是第一个组件的值
重现步骤
// page export default class pageDemo extends Taro.Component { componentDidMount () { Taro.createSelectorQuery() .selectAll('.child') .boundingClientRect() .exec(res => { console.log(res) }) } render () { return ( <View> <Child /> <Child /> </View> ) } }
// child export default class pageDemo extends Taro.Component { componentDidMount () { Taro.createSelectorQuery() .in(this.$scope) .select('.child') .boundingClientRect() .exec(res => { console.log(res) }) } render () { return <View className='child'>1111</View> } }
期望行为
希望能提供类似的方法 和 临时解决方案
系统信息
上面这个问题产生的原因是:
支付宝 input 组件的 bindinput 事件 无法 return 字符串更改内容