Skip to content
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

vue3 AvatarCropper小程序报错 TypeError: Cannot read property 'node' of null #2931

Closed
yangyingbiao opened this issue Feb 24, 2024 · 3 comments
Labels
Need Reproduce 需要提供可复现的代码用于问题排查 to be closed

Comments

@yangyingbiao
Copy link

NutUI 包名

@nutui/nutui-taro

NutUI 版本号

4.3.0

平台

weapp

重现链接

https://nutui.jd.com/playground/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8bnV0LWF2YXRhci1jcm9wcGVyIHNoYXBlPVwic3F1YXJlXCIgQGNvbmZpcm09XCJjb25maXJtXCI+XG4gICAgICA8bnV0LWF2YXRhciBzaXplPVwibGFyZ2VcIiBzaGFwZT1cInNxdWFyZVwiPlxuICAgICAgICAgIDxpbWcgdi1pZj1cImltYWdlVXJsXCIgOnNyYz1cImltYWdlVXJsXCIgLz5cbiAgICAgIDwvbnV0LWF2YXRhcj5cbiAgPC9udXQtYXZhdGFyLWNyb3BwZXI+XG48L3RlbXBsYXRlPiJ9

重现步骤

<nut-avatar-cropper shape="square" @confirm="confirm">



期望的结果是什么?

正常使用

实际的结果是什么?

TypeError: Cannot read property 'node' of null
at Object. (.node_modules.pnpm_@[email protected][email protected]_vue@3.4.19_node_modules_@nutui_nutui-taro_dist_packages_avatarcropper_AvatarCropper.js:183)
at Function. (WAServiceMainContext.js?t=wechat&s=1708735279343&v=3.3.4:1)
at :30069/appservice/
at WAServiceMainContext.js?t=wechat&s=1708735279343&v=3.3.4:1
at WAServiceMainContext.js?t=wechat&s=1708735279343&v=3.3.4:1
at Array.forEach ()
at WAServiceMainContext.js?t=wechat&s=1708735279343&v=3.3.4:1
at WAServiceMainContext.js?t=wechat&s=1708735279343&v=3.3.4:1
at WASubContext.js?t=wechat&s=1708735279343&v=3.3.4:1
at ve (WASubContext.js?t=wechat&s=1708735279343&v=3.3.4:1)(env: Windows,mp,1.06.2306020; lib: 3.3.4)

useReady(() => {
if (showCanvas2D.value) {
const { canvasId } = canvasAll;
Taro.createSelectorQuery().select(#${canvasId}).node(({ node: canvas }) => {
canvas.width = state.displayWidth;
canvas.height = state.displayHeight;
canvasAll.cropperCanvas = canvas;
}).exec();
}
});

环境信息

"@tarojs/taro": "3.6.5",
"@nutui/nutui-taro": "^4.3.0",

其他补充信息

node

@yangyingbiao
Copy link
Author

是微信小程序的原因,useReady(() => {
setTimeout(() => {
if (showCanvas2D.value) {
const { canvasId } = canvasAll;
Taro.createSelectorQuery().select(#${canvasId}).node(({ node: canvas }) => {
canvas.width = state.displayWidth;
canvas.height = state.displayHeight;
canvasAll.cropperCanvas = canvas;
}).exec();
}
}, 500)
});
延时再获取createSelectorQuery

@yi-boide
Copy link
Contributor

你在你的项目中是怎么使用的?官方例子我允行在微信小程序没有发现这个问题。

@eiinu eiinu added the Need Reproduce 需要提供可复现的代码用于问题排查 label Feb 26, 2024
Copy link

你好 @yangyingbiao, 我们需要你提供一个最小重现实例以便于我们帮你排查问题。你可以提供一个基于 Taro NutUI4.0 模板项目的 GitHub 仓库链接(@nutui/nutui-taro),也可以通过 CodeSandbox 创建一个在线实例(@nutui/nutui)。请确保选择准确的版本。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Need Reproduce 需要提供可复现的代码用于问题排查 to be closed
Projects
None yet
Development

No branches or pull requests

3 participants