-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
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
feat(switch): v14&代码重构 #2779
Merged
Merged
feat(switch): v14&代码重构 #2779
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
92b4a54
fix: 适配v14&代码重构
irisSong 20d4f47
fix: 支持rtl
irisSong 485a534
fix: 修改居中实现方式
irisSong 915250f
fix: 修改动画
irisSong 90af513
chore: 合并V3.0
irisSong 400e214
fix: 适配v14
irisSong 26a008c
feat: add marking
irisSong 975544f
fix: 修改cr
irisSong 53dfc81
Merge remote-tracking branch 'upstream/feat_v3.x' into 3.0-switch
irisSong 05e74d1
fix: 修整繁体字翻译错误+添加cursor
irisSong babc359
fix: modify css var
irisSong e03b7f1
fix: 修改toast来源+升级文档更新
irisSong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -673,6 +673,7 @@ | |
"sort": 11, | ||
"show": true, | ||
"taro": true, | ||
"v14": true, | ||
"author": "dsj" | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import { Cell, Switch } from '@nutui/nutui-react' | ||
|
||
const Demo7 = () => { | ||
return ( | ||
<Cell> | ||
<Switch | ||
defaultChecked | ||
style={{ | ||
'--nutui-switch-active-background-color': 'blue', | ||
'--nutui-switch-inactive-line-background-color': '#ebebeb', | ||
}} | ||
/> | ||
</Cell> | ||
) | ||
} | ||
export default Demo7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
import React, { useState } from 'react' | ||
import { Cell, Switch } from '@nutui/nutui-react-taro' | ||
import Taro from '@tarojs/taro' | ||
import { Cell, Switch, Toast } from '@nutui/nutui-react-taro' | ||
|
||
const Demo2 = () => { | ||
const [checkedAsync, setCheckedAsync] = useState(true) | ||
const [value, setValue] = useState(false) | ||
const [showToast, setShowToast] = useState(false) | ||
|
||
const onChangeAsync = (value: boolean, event: any) => { | ||
Taro.showToast({ title: `2秒后异步触发 ${value}` }) | ||
setValue(value) | ||
setShowToast(true) | ||
setTimeout(() => { | ||
setCheckedAsync(value) | ||
}, 2000) | ||
} | ||
return ( | ||
<Cell> | ||
<Switch | ||
checked={checkedAsync} | ||
onChange={(value, event) => onChangeAsync(value, event)} | ||
<> | ||
<Cell> | ||
<Switch | ||
checked={checkedAsync} | ||
onChange={(value, event) => onChangeAsync(value, event)} | ||
/> | ||
</Cell> | ||
<Toast | ||
type="text" | ||
content={`2秒后异步触发 ${value}`} | ||
visible={showToast} | ||
Comment on lines
+26
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Toast 内容显示可能不准确
建议修改如下: <Toast
type="text"
- content={`2秒后异步触发 ${value}`}
+ content={`2秒后异步触发 ${checkedAsync}`}
visible={showToast}
onClose={() => {
setShowToast(false)
}}
/>
|
||
onClose={() => { | ||
setShowToast(false) | ||
}} | ||
/> | ||
</Cell> | ||
</> | ||
) | ||
} | ||
export default Demo2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
测试用例中的样式覆盖不完整
根据组件源码分析,当前测试用例仅覆盖了
--nutui-switch-active-background-color
和fontSize
,但组件实际使用了多个重要的样式变量,包括:$switch-width
、$switch-height
、$switch-line-height
$switch-border-radius
、$switch-border-width
$switch-inactive-background-color
、$switch-active-disabled-background-color
$switch-label-font-size
、$switch-label-text-color
建议补充以下测试场景:
🔗 Analysis chain
样式属性更新应覆盖完整
在测试中,
style
对象更新了--nutui-switch-active-background-color
,但缺少其他可能影响组件显示的样式属性,建议检查并确保所有相关样式都已正确覆盖。请运行以下脚本以验证样式属性:
Let me generate additional verification to check the actual CSS custom properties being used in the component:
Let me try one more verification to check the CSS custom properties in the component's SCSS file with proper escaping:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 4855
Script:
Length of output: 745
Script:
Length of output: 2532