We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
微信小程序
小程序基础库: 2.16.0 使用框架: React
B.tsx:
export default class B extends Component<any, any> { static externalClasses = ["my-class"] render() { return (<View className="my-class">111111111111</View>) } }
A.tsx:
export default class A extends Component<any, any> { render() { return (<ScrollView scrollY={true} scrollWithAnimation={true} className={"videos-wrapper"}> <B my-class="red-text"/> </ScrollView>) } }
a.scss:
.red-text { color: red; }
.red-text的color 生效到B.tsx的view上
没有生效
Taro CLI 3.2.0 environment info: System: OS: macOS 10.14.5 Shell: 5.3 - /bin/zsh Binaries: Node: 12.22.0 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.14.11 - /usr/local/bin/npm npmPackages: @tarojs/components: 3.2.0 => 3.2.0 @tarojs/mini-runner: 3.2.0 => 3.2.0 @tarojs/react: 3.2.0 => 3.2.0 @tarojs/runtime: 3.2.0 => 3.2.0 @tarojs/taro: 3.2.0 => 3.2.0 @tarojs/webpack-runner: 3.2.0 => 3.2.0 babel-preset-taro: 3.2.0 => 3.2.0 eslint-config-taro: 3.2.0 => 3.2.0 react: ^17.0.0 => 17.0.2 npmGlobalPackages: typescript: 3.7.3
The text was updated successfully, but these errors were encountered:
@Wkevin8 在 Taro 3 中,React 的组件 不对应 小程序自定义组件,而 externalClasses 是小程序自定义组件的功能。
externalClasses
你的需求按普通 React 写法即可:
// B.tsx class B extends Component<any, any> { render() { return ( <View className={this.props.myClass}>111111111111</View> ) } }
// A.tsx class A extends Component<any, any> { render() { return ( <ScrollView scrollY scrollWithAnimation className="videos-wrapper" > <B myClass="red-text"/> </ScrollView> ) } }
// a.scss .red-text { color: red; }
Sorry, something went wrong.
No branches or pull requests
相关平台
微信小程序
小程序基础库: 2.16.0
使用框架: React
复现步骤
B.tsx:
A.tsx:
a.scss:
期望结果
.red-text的color 生效到B.tsx的view上
实际结果
没有生效
环境信息
The text was updated successfully, but these errors were encountered: