Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d7e7d86
fix(badge): 解决中文偏上问题
irisSong Mar 21, 2025
532e0e1
fix: css 变量更新
irisSong Mar 21, 2025
c912d43
Merge branch 'feat_v3.x' of https://github.com/irisSong/nutui-react i…
irisSong Apr 27, 2025
9a49448
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong Apr 30, 2025
0324919
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong May 14, 2025
87c7e2e
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong Jun 9, 2025
929799b
fix: 为兼容 cpp 版本做的暂时性的牺牲改动 (#3325)
xiaoyatong Aug 7, 2025
7ee836a
Merge branch 'feat_v3.x' into feat_v3.x_cpp
xiaoyatong Aug 15, 2025
94c5073
chore: 升级版本号
xiaoyatong Aug 20, 2025
5dfd20f
feat(popup): 增加上下滑动修改高度
xiaoyatong Aug 20, 2025
bd12ee6
feat: 合并popup功能
xiaoyatong Aug 21, 2025
e47d0d4
feat(popup): 添加自定义顶部
xiaoyatong Aug 21, 2025
e7a4b1f
fix(input): taro 下只读可以点击
xiaoyatong Aug 21, 2025
75057e6
feat(popup): 增加一些新属性,顺便解决了下input的只读无法点击、焦点等问题 (#3342)
xiaoyatong Aug 21, 2025
7da9642
chore: 升级版本号
xiaoyatong Aug 29, 2025
08e97b5
feat: 新样式变量值更新,修订dialog暗黑问题
xiaoyatong Sep 3, 2025
3da0ec6
chore: 修改版本号
xiaoyatong Sep 20, 2025
e90b2b2
feat(popup): 增加top属性,支持自定义节点,,且不popup高度
xiaoyatong Sep 20, 2025
3cbfe75
chore: 修改版本号
xiaoyatong Sep 20, 2025
e1b4fc9
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong Sep 22, 2025
b6cab32
fix: 更正正黑字体
irisSong Sep 29, 2025
acaa6c2
fix: 更正正黑字体
irisSong Sep 29, 2025
7e230c9
feat: 更新字体版本
irisSong Sep 29, 2025
88462db
feat: 合并3.x 分支
xiaoyatong Sep 29, 2025
8ce8c51
Feat v3 cpp td (#3364)
xiaoyatong Sep 29, 2025
68c851b
feat(dialog): 升级样式规范
xiaoyatong Oct 2, 2025
32b4cea
feat(dialog): 升级样式规范
xiaoyatong Oct 2, 2025
4e6df5d
feat: 修订button在安卓下的问题
xiaoyatong Oct 3, 2025
cf0553a
fix(noticebar): 获取rect异常时不处理
xiaoyatong Oct 4, 2025
1509b39
feat(noticebar): 增加自定义children时的样式,重构部分代码
xiaoyatong Oct 5, 2025
710afd9
feat(input): 去掉lineheight
xiaoyatong Oct 5, 2025
2be0323
feat(checkbox): 增加选中态自定义类名
xiaoyatong Oct 5, 2025
2379441
fix: dialog规范及toast ios和安卓适配问题修订
xiaoyatong Oct 9, 2025
e7f84cc
fix(dialog): 适配ios和安卓,动效暂时屏蔽
xiaoyatong Oct 10, 2025
7054cee
fix(noticebar): 增加ref id
xiaoyatong Oct 13, 2025
93c518f
feat(dialog): demo
xiaoyatong Oct 13, 2025
1b997a4
fix: 去掉不支持的样式
xiaoyatong Oct 13, 2025
23dba7a
fix: 回跨不兼容样式处理
xiaoyatong Oct 14, 2025
0354507
fix: 回跨不兼容样式处理,不能暴露~~
xiaoyatong Oct 14, 2025
dadca5b
fix: setTimeout 改调 Taro.nextTick 调用,保证rect能够获取成功 (#3369)
aniwei Oct 15, 2025
77ae33b
feat: 修订 toast 鸿蒙下折行问题,noticebar 获取宽度问题
xiaoyatong Oct 15, 2025
01a2bca
fix: ios/安卓不支持属性增加判断
xiaoyatong Oct 21, 2025
3d88959
feat: dialog 底部按钮增加角标展示
xiaoyatong Oct 24, 2025
075b551
fix: hack 动效 tabs 安卓
xiaoyatong Oct 24, 2025
884d3bc
Feat v3.x aria (#3387)
yangyanAurora Nov 14, 2025
b66439e
feat: 无障碍类型检测屏蔽
xiaoyatong Nov 14, 2025
e9f4a44
fix: 无需处理容器维度,系统会无法读取内部的文字
xiaoyatong Nov 17, 2025
63ac053
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong Dec 6, 2025
dc5e96f
feat(price): dynamic和harmony结构保持一致
irisSong Dec 6, 2025
83a322d
fix(dialog): 先不处理
xiaoyatong Dec 15, 2025
7c90fbf
Merge remote-tracking branch 'upstream/feat_v3.x' into feat_v3.x
irisSong Dec 17, 2025
4bb94ef
fix(steps): taro版本div标签替换成view标签
irisSong Dec 17, 2025
362fd9f
Merge remote-tracking branch 'upstream/feat_v3.x_cpp' into feat_v3.x
irisSong Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui-react-taro",
"version": "3.0.18",
"version": "3.0.19-cpp.19",
"style": "dist/style.css",
"main": "dist/nutui.react.umd.js",
"module": "dist/es/packages/nutui.react.build.js",
Expand Down Expand Up @@ -109,7 +109,7 @@
"dependencies": {
"@babel/runtime": "^7.23.9",
"@nutui/icons-react": "^3.0.2-beta.5",
"@nutui/icons-react-taro": "^3.0.2-beta.3",
"@nutui/icons-react-taro": "3.0.2-cpp.3.beta.3",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find and read the package.json file
cd . && pwd
git ls-files package.json

Repository: jdf2e/nutui-react

Length of output: 92


🏁 Script executed:

# Count lines and read the relevant sections
wc -l package.json

Repository: jdf2e/nutui-react

Length of output: 77


🏁 Script executed:

# Read lines around 112 and 245 in package.json
sed -n '105,120p' package.json
sed -n '240,250p' package.json

Repository: jdf2e/nutui-react

Length of output: 809


🏁 Script executed:

# Also search for the resolutions section
grep -n "resolutions" package.json

Repository: jdf2e/nutui-react

Length of output: 83


🏁 Script executed:

# Read the resolutions section and nearby lines
sed -n '235,246p' package.json

Repository: jdf2e/nutui-react

Length of output: 363


🏁 Script executed:

# Search for all occurrences of @nutui/icons-react-taro with line numbers
rg -n "@nutui/icons-react-taro" package.json

Repository: jdf2e/nutui-react

Length of output: 167


解决依赖版本不一致问题

@nutui/icons-react-taro 在 dependencies 中指定为精确版本 3.0.2-cpp.3.beta.3(第 112 行),但在 resolutions 中使用 ^3.0.2-cpp.1(第 245 行)。这两个版本范围不匹配,resolutions 中的范围可能导致安装不同的版本,破坏依赖一致性。请统一这两处的版本指定。

"@nutui/jdesign-icons-react-taro": "1.0.6-beta.2",
"@nutui/touch-emulator": "^1.0.0",
"@nutui/lottie-miniprogram": "^1.0.2",
Expand Down Expand Up @@ -241,6 +241,7 @@
"@types/react-dom": "^18.2.19",
"sass": "1.77.6",
"@tarojs/api": "4.0.12",
"@tarojs/components": "4.0.12"
"@tarojs/components": "4.0.12",
"@nutui/icons-react-taro": "^3.0.2-cpp.1"
}
}
14,997 changes: 7,870 additions & 7,127 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/hooks/taro/use-custom-event.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useEffect, useRef } from 'react'
import isEqual from 'react-fast-compare'
import { Events, getCurrentInstance } from '@tarojs/taro'
import { eventCenter, getCurrentInstance } from '@tarojs/taro'
import { useForceUpdate } from '@/hooks/use-force-update'

export const customEvents = new Events()
// export const customEvents = new Events()
export const customEvents = eventCenter

export function useCustomEventsPath(selector?: string) {
selector = selector || ''
Expand Down
2 changes: 2 additions & 0 deletions src/locales/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface BaseLang {
select: string
edit: string
reset: string
close: string
video: {
errorTip: string
clickRetry: string
Expand Down Expand Up @@ -140,4 +141,5 @@ export interface BaseLang {
watermark: {
errorCanvasTips: string
}
mask: string
}
2 changes: 2 additions & 0 deletions src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const enUS: BaseLang = {
select: 'Select',
edit: 'Edit',
reset: 'Reset',
close: 'Close',
video: {
errorTip: 'Error Tip',
clickRetry: 'Click Retry',
Expand Down Expand Up @@ -139,5 +140,6 @@ const enUS: BaseLang = {
watermark: {
errorCanvasTips: 'Canvas is not supported in the current environment',
},
mask: 'Mask',
}
export default enUS
2 changes: 2 additions & 0 deletions src/locales/id-ID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const idID: BaseLang = {
select: 'Pilih',
edit: 'Sunting',
reset: 'Mengatur Ulang',
close: 'Tutup',
video: {
errorTip: 'Terjadi Kesalahan',
clickRetry: 'Coba Lagi',
Expand Down Expand Up @@ -140,5 +141,6 @@ const idID: BaseLang = {
watermark: {
errorCanvasTips: 'Canvas is not supported in the current environment',
},
mask: 'Masker',
}
export default idID
2 changes: 2 additions & 0 deletions src/locales/tr-TR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const trTR: BaseLang = {
select: 'Seçiniz',
edit: 'düzenlemek',
reset: 'sıfırlama',
close: 'Kapat',
video: {
errorTip: 'Video yüklenemedi',
clickRetry: 'Yeniden Tıklayın',
Expand Down Expand Up @@ -148,5 +149,6 @@ const trTR: BaseLang = {
watermark: {
errorCanvasTips: 'Geçerli ortam Canvası desteklemiyor',
},
mask: 'Maske',
}
export default trTR
2 changes: 2 additions & 0 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const zhCN: BaseLang = {
select: '请选择',
edit: '编辑',
reset: '重置',
close: '关闭',
video: {
errorTip: '视频加载失败',
clickRetry: '点击重试',
Expand Down Expand Up @@ -140,5 +141,6 @@ const zhCN: BaseLang = {
watermark: {
errorCanvasTips: '当前环境不支持Canvas',
},
mask: '蒙层',
}
export default zhCN
2 changes: 2 additions & 0 deletions src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const zhCN: BaseLang = {
select: '請選擇',
edit: '編輯',
reset: '重置',
close: '關閉',
video: {
errorTip: '視頻加載失敗',
clickRetry: '點擊重試',
Expand Down Expand Up @@ -140,5 +141,6 @@ const zhCN: BaseLang = {
watermark: {
errorCanvasTips: '當前環境不支持Canvas',
},
mask: '蒙層',
}
export default zhCN
2 changes: 2 additions & 0 deletions src/locales/zh-UG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const zhUG: BaseLang = {
select: 'تاللاڭ',
edit: 'يحرر',
reset: 'إعادة ضبط',
close: 'تاقاش',
video: {
errorTip: 'فىلىمنى قويۇش مەغلۇپ بولدى',
clickRetry: 'قايتا سىناش',
Expand Down Expand Up @@ -138,5 +139,6 @@ const zhUG: BaseLang = {
watermark: {
errorCanvasTips: 'Canvas نى قوللىمايدۇ',
},
mask: 'mask',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

本地化字段未翻译

mask 字段使用了英文 'mask' 而非维吾尔语翻译,与文件中其他字段的完整翻译不一致。建议补充维吾尔语翻译以保持本地化的完整性。

🤖 Prompt for AI Agents
In src/locales/zh-UG.ts around line 142, the localization key mask is left as
the English string 'mask' instead of a Uyghur translation; replace the value
with the proper Uyghur translation (e.g., "نىقاب") so the entry is translated
consistently with the rest of the file.

}
export default zhUG
2 changes: 2 additions & 0 deletions src/packages/actionsheet/actionsheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
&-safe-area {
display: block;
width: 100%;
/* #ifndef dynamic*/
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
/* #endif */
}
}
5 changes: 5 additions & 0 deletions src/packages/animatingnumbers/countup.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.nut-countup {
&-list {
/* #ifdef dynamic*/
display: flex;
/* #endif */
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
height: $countup-height;
overflow: hidden;
direction: ltr;
Expand Down
2 changes: 2 additions & 0 deletions src/packages/avatarcropper/avatarcropper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@

&.top {
top: 0;
/* #ifndef dynamic*/
bottom: inherit;
/* #endif */
}

&-flex {
Expand Down
8 changes: 3 additions & 5 deletions src/packages/avatarcropper/avatarcropper.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
useMemo,
useCallback,
FunctionComponent,
useLayoutEffect,
} from 'react'
import Taro, { createSelectorQuery } from '@tarojs/taro'
import Taro, { useReady, createSelectorQuery } from '@tarojs/taro'
import classNames from 'classnames'
import { Canvas, CommonEventFunction, View } from '@tarojs/components'
import { getWindowInfo } from '@/utils/taro/get-system-info'
Expand Down Expand Up @@ -138,7 +137,7 @@
cropperCanvasContext: null,
})

useLayoutEffect(() => {
useReady(() => {
if (showAlipayCanvas2D) {
const { canvasId } = canvasAll
createSelectorQuery()
Expand All @@ -150,14 +149,14 @@
})
.exec()
}
}, [showAlipayCanvas2D, state.displayHeight, state.displayWidth])
})

useEffect(() => {
setCanvasAll({
...canvasAll,
cropperCanvasContext: Taro.createCanvasContext(canvasAll.canvasId),
})
}, [])

Check warning on line 159 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'canvasAll'. Either include it or remove the dependency array. You can also do a functional update 'setCanvasAll(c => ...)' if you only need 'canvasAll' in the 'setCanvasAll' call

Check warning on line 159 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'canvasAll'. Either include it or remove the dependency array. You can also do a functional update 'setCanvasAll(c => ...)' if you only need 'canvasAll' in the 'setCanvasAll' call

const touch = useTouch()

Expand All @@ -169,7 +168,7 @@
height,
borderRadius: shape === 'round' ? '50%' : '',
}
}, [pixelRatio, state.cropperWidth])

Check warning on line 171 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useMemo has a missing dependency: 'shape'. Either include it or remove the dependency array

Check warning on line 171 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useMemo has a missing dependency: 'shape'. Either include it or remove the dependency array

// 是否是横向
const isAngle = useMemo(() => {
Expand Down Expand Up @@ -251,7 +250,7 @@
ctx.scale(scale, scale)
ctx.drawImage(src as HTMLImageElement, x, y, width, height)
},
[drawImage, state]

Check warning on line 253 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'pixelRatio' and 'space'. Either include them or remove the dependency array

Check warning on line 253 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'pixelRatio' and 'space'. Either include them or remove the dependency array
)

// web绘制
Expand All @@ -268,7 +267,7 @@
canvas.height = state.displayHeight
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D
canvas2dDraw(ctx)
}, [canvas2dDraw])

Check warning on line 270 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'canvasAll.canvasId', 'state.displayHeight', and 'state.displayWidth'. Either include them or remove the dependency array

Check warning on line 270 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'canvasAll.canvasId', 'state.displayHeight', and 'state.displayWidth'. Either include them or remove the dependency array

const alipayDraw = useCallback(() => {
const ctx = canvasAll.cropperCanvas.getContext(
Expand Down Expand Up @@ -325,7 +324,7 @@
ctx.scale(scale, scale)
ctx.drawImage(src as string, x, y, width, height)
ctx.draw()
}, [drawImage, state.scale, state.angle, state.moveX, state.moveY])

Check warning on line 327 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'alipayDraw', 'canvasAll', 'showAlipayCanvas2D', 'space', 'state', and 'webDraw'. Either include them or remove the dependency array

Check warning on line 327 in src/packages/avatarcropper/avatarcropper.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has missing dependencies: 'alipayDraw', 'canvasAll', 'showAlipayCanvas2D', 'space', 'state', and 'webDraw'. Either include them or remove the dependency array

useEffect(() => {
if (Math.abs(state.moveX) > maxMoveX) {
Expand Down Expand Up @@ -694,5 +693,4 @@
</>
)
}

AvatarCropper.displayName = 'NutAvatarCropper'
12 changes: 11 additions & 1 deletion src/packages/badge/badge.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.nut-badge {
position: relative;
/* #ifdef dynamic*/
display: flex;
/* #endif */
/* #ifndef dynamic*/
display: inline-flex;
vertical-align: middle;
box-sizing: content-box;
/* #endif */
vertical-align: middle;
width: auto;

&-icon {
Expand Down Expand Up @@ -38,7 +43,12 @@
}

&-sup {
/* #ifdef dynamic*/
display: flex;
/* #endif */
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
text-align: center;
min-width: $badge-min-width;
padding: $badge-padding;
Expand Down
3 changes: 3 additions & 0 deletions src/packages/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
transform: translate(-50%, -50%);
opacity: 0;
content: ' ';
/* #ifdef dynamic*/
pointer-events: none;
/* #endif */
}

&::after {
Expand Down
37 changes: 20 additions & 17 deletions src/packages/button/button.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import React, { CSSProperties, useCallback, useMemo } from 'react'
import type { MouseEvent } from 'react'
import classNames from 'classnames'
import {
ButtonProps as MiniProgramButtonProps,
// ButtonProps as MiniProgramButtonProps,
View,
Button as TaroButton,
// Button as TaroButton,
} from '@tarojs/components'
import { Loading } from '@nutui/icons-react-taro'
import { getEnv } from '@tarojs/taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { harmony } from '@/utils/taro/platform'

type OmitMiniProgramButtonProps = Omit<
MiniProgramButtonProps,
'size' | 'type' | 'onClick' | 'style'
>
// type OmitMiniProgramButtonProps = Omit<
// MiniProgramButtonProps,
// 'size' | 'type' | 'onClick' | 'style'
// >
Comment on lines +5 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd /tmp && find . -name "button.taro.tsx" -o -name "button*" -type f 2>/dev/null | head -20

Repository: jdf2e/nutui-react

Length of output: 391


🏁 Script executed:

find /repo -name "button.taro.tsx" -type f 2>/dev/null

Repository: jdf2e/nutui-react

Length of output: 43


🏁 Script executed:

# First, find the file
find . -path "*/packages/button/button.taro.tsx" -o -path "*/button.taro.tsx" 2>/dev/null | head -5

Repository: jdf2e/nutui-react

Length of output: 98


🏁 Script executed:

# Find button component files
rg -l "button.taro" . 2>/dev/null | head -10

Repository: jdf2e/nutui-react

Length of output: 325


🏁 Script executed:

# List files in src/packages/button directory
ls -la src/packages/button/ 2>/dev/null || find . -type d -name button 2>/dev/null | grep -E "packages|components" | head -5

Repository: jdf2e/nutui-react

Length of output: 984


🏁 Script executed:

# Find the button.taro.tsx file
find . -name "button.taro.tsx" 2>/dev/null

Repository: jdf2e/nutui-react

Length of output: 98


🏁 Script executed:

cat src/packages/button/button.taro.tsx 2>/dev/null | head -50

Repository: jdf2e/nutui-react

Length of output: 1433


删除已注释的代码,并验证 View 作为按钮容器是否完整支持 Taro 表单功能。

ButtonProps 接口中声明了 nativeType: 'submit' | 'reset',但使用 View 代替 TaroButton 会导致以下问题需要明确解决:

  1. 表单提交能力:Taro 中,当表单内 Button 组件的 formType 设置为 submit 时,点击按钮会提交表单内的值。View 组件无法原生支持此功能,nativeType 属性的实现需要通过 JavaScript 事件处理手动完成。

  2. 小程序特性丧失:使用 View 替代 TaroButton 会失去 WeChat 小程序的 openType、getUserInfo 等扩展功能。

  3. 类型不匹配:onClick 回调使用 MouseEvent<HTMLButtonElement> 类型,这是浏览器类型而非 Taro 兼容类型,需要确认在小程序环境下的行为。

NutUI React 采用平台特定文件命名形式(原文件名 + 端类型)来处理不同平台差异,因此此设计可能是有意的。但需验证:

  • nativeType 属性的实际实现是否完整
  • 是否存在对应的 button.h5.tsx 实现
  • View 的无障碍属性是否已补全(role、aria-* 属性)
🤖 Prompt for AI Agents
In src/packages/button/button.taro.tsx around lines 5 to 16, remove the stale
commented imports and then ensure the replacement View-based button fully covers
Taro/native features: implement nativeType handling by wiring form
submission/reset behavior when nativeType is 'submit'|'reset' (simulate Taro
Button formType via programmatic form submit/reset or emit the proper Taro
events), document or gate unsupported mini-program-only props (openType,
getUserInfo) or reintroduce Taro Button for those cases, change the onClick
typing from DOM MouseEvent<HTMLButtonElement> to the appropriate Taro event
type, and add accessibility attributes to the View (role="button", tabIndex,
aria-* and keyboard handlers). Also verify there is a platform-specific
button.h5.tsx implementation or add one if needed so behavior differs per
platform.


export type ButtonType =
| 'default'
Expand All @@ -27,9 +26,11 @@ export type ButtonSize = 'xlarge' | 'large' | 'normal' | 'small' | 'mini'
export type ButtonShape = 'square' | 'round'
export type ButtonFill = 'solid' | 'outline' | 'dashed' | 'none'

export interface ButtonProps
extends BasicComponent,
OmitMiniProgramButtonProps {
// export interface ButtonProps
// extends BasicComponent,
// OmitMiniProgramButtonProps {

export interface ButtonProps extends BasicComponent {
color: string
shape: ButtonShape
type: ButtonType
Expand Down Expand Up @@ -76,7 +77,7 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
children,
className,
style,
formType,
// formType,
nativeType,
onClick,
...rest
Expand Down Expand Up @@ -145,17 +146,18 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
className
)

if (getEnv() === 'WEB') {
;(rest as any).type = formType
}
// if (getEnv() === 'WEB') {
// ;(rest as any).type = formType
// }
return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line react/button-has-type
<TaroButton
// <TaroButton
<View
{...rest}
ref={ref}
formType={formType || nativeType}
// formType={formType || nativeType}
className={buttonClassNames}
style={{ ...getStyle, ...style }}
onClick={(e) => handleClick(e as any)}
Expand All @@ -175,7 +177,8 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
)}
{rightIcon}
</View>
</TaroButton>
</View>
// </TaroButton>
)
}
)
Expand Down
2 changes: 2 additions & 0 deletions src/packages/cascader/cascader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
}

.nut-tabs-titles-item {
/* #ifndef dynamic*/
flex: initial;
min-width: auto;
/* #endif */
width: auto;
padding: $cascader-tabs-item-padding;
white-space: nowrap;
Expand Down
4 changes: 4 additions & 0 deletions src/packages/cellgroup/cellgroup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
display: block;

&-title {
/* #ifndef dynamic*/
display: inherit;
/* #endif */
padding: $cell-group-title-padding;
color: $cell-group-title-color;
font-size: $cell-group-title-font-size;
Expand All @@ -12,7 +14,9 @@
}

&-description {
/* #ifndef dynamic*/
display: inherit;
/* #endif */
padding: $cell-group-description-padding;
color: $cell-group-description-color;
font-size: $cell-group-description-font-size;
Expand Down
5 changes: 5 additions & 0 deletions src/packages/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@

&-button {
position: relative;
/* #ifdef dynamic*/
display: flex;
/* #endif */
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
align-items: center;
min-height: 32px;
padding: $checkbox-button-padding;
Expand Down
4 changes: 4 additions & 0 deletions src/packages/checkbox/checkbox.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ export const Checkbox: FC<
{
[`${classPrefix}-reverse`]: labelPosition === 'left',
'nut-checkbox-list-item': ctx?.list,
[`${classPrefix}-active`]: innerChecked,
},
className
)}
{...rest}
onClick={handleClick}
ariaRole="checkbox"
tabIndex={innerDisabled ? -1 : 0}
ariaChecked={innerIndeterminate ? 'mixed' : innerChecked}
>
{renderCheckboxItem()}
</View>
Expand Down
Loading
Loading