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
微信小程序
小程序基础库: 3.0.1 使用框架: React
import React, { CSSProperties, useState } from 'react'; import { Button, View } from '@tarojs/components'; const Demo3 = () => { const [style, setStyle] = useState<CSSProperties>({ "color": "red", }); return ( <View style={style}> <Button onClick={() => { setStyle({}); }} > 切换颜色 </Button> <View className="bg">{JSON.stringify(style)}</View> </View> ); }; export default Demo3;
点击切换颜色按钮
view 的 style 不再有 color 属性
view 的 style 还有 color 属性,只是值变成空了
style 改成 {} 后 color 属性还在,这样会导致在使用 var 变量控制样式的时候,没有把属性清除导致无法把属性值恢复成 var 变量设置的默认值。。。
{}
👽 Taro v3.6.14 Taro CLI 3.6.14 environment info: System: OS: macOS 13.5.1 Shell: 5.9 - /bin/zsh Binaries: Node: 16.15.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.11.0 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.6.14 => 3.6.14 @tarojs/components: 3.6.14 => 3.6.14 @tarojs/helper: 3.6.14 => 3.6.14 @tarojs/plugin-framework-react: 3.6.14 => 3.6.14 @tarojs/plugin-platform-alipay: 3.6.14 => 3.6.14 @tarojs/plugin-platform-h5: 3.6.14 => 3.6.14 @tarojs/plugin-platform-jd: 3.6.14 => 3.6.14 @tarojs/plugin-platform-qq: 3.6.14 => 3.6.14 @tarojs/plugin-platform-swan: 3.6.14 => 3.6.14 @tarojs/plugin-platform-tt: 3.6.14 => 3.6.14 @tarojs/plugin-platform-weapp: 3.6.14 => 3.6.14 @tarojs/react: 3.6.14 => 3.6.14 @tarojs/runtime: 3.6.14 => 3.6.14 @tarojs/shared: 3.6.14 => 3.6.14 @tarojs/taro: 3.6.14 => 3.6.14 @tarojs/taro-loader: 3.6.14 => 3.6.14 @tarojs/webpack5-runner: 3.6.14 => 3.6.14 babel-preset-taro: 3.6.14 => 3.6.14 eslint-config-taro: 3.6.14 => 3.6.14 react: ^18.0.0 => 18.2.0 npmGlobalPackages: typescript: 4.9.5
The text was updated successfully, but these errors were encountered:
fix(runtime): remove the style property when the value is an empty st…
81560c3
…ring NervJS#14463
@ZakaryCode 这个 PR 可以 merge 吗~
Sorry, something went wrong.
bdc89a5
…ring #14463
Successfully merging a pull request may close this issue.
相关平台
微信小程序
小程序基础库: 3.0.1
使用框架: React
复现步骤
点击切换颜色按钮
期望结果
view 的 style 不再有 color 属性
实际结果
view 的 style 还有 color 属性,只是值变成空了
其他信息
style 改成
{}
后 color 属性还在,这样会导致在使用 var 变量控制样式的时候,没有把属性清除导致无法把属性值恢复成 var 变量设置的默认值。。。环境信息
The text was updated successfully, but these errors were encountered: