问题描述
[请问Taro现在支持ref的回调引用吗??]
*复现步骤
import Taro, { Component } from '@tarojs/taro'
import { View,Image} from '@tarojs/components'
export default class Detail extends Component {
constructor(props){
super(props);
this.content =null;
this.domRef = element=>{
this.content = element;
}
}
onScrolltoupper(){
console.log(this.content);
}
render(){
<ScrollView scrollY
scrollWithAnimation
scrollTop='0'
style='height: 150px;'
upperThreshold='20'
onScrolltoupper={this.onScrolltoupper}>
<View ref={this.domRef} ClassName="example">123</View>
</ScrollView>
}
}
期望行为
[期望打印出当前DOM节点信息]
报错信息
[打印出null]
系统信息
现在还不能支持
如果想对dom元素添加动态样式该怎么做?文档好像没有提及?尝试了很多种方法,好像都会报错
@Harhao https://nervjs.github.io/taro/native-api.html#wxml%E8%8A%82%E7%82%B9%E4%BF%A1%E6%81%AF
可以使用这个
@luckyadam 打不开你发的网址哎