taro-ui icon indicating copy to clipboard operation
taro-ui copied to clipboard

编译完成后打开小程序会报这个问题。

Open w5mm opened this issue 1 year ago • 3 comments

TypeError: u.contains is not a function at I (VM1272 vendors.js:10566) at P (VM1272 vendors.js:10566) at O (VM1272 vendors.js:10566) at P (VM1272 vendors.js:10566) at O (VM1272 vendors.js:10566) at P (VM1272 vendors.js:10566) at z (VM1272 vendors.js:10566) at O (VM1272 vendors.js:10566)

at P (VM1272 vendors.js:10566)
at z (VM1272 vendors.js:10566)

Snipaste_2024-11-04_17-35-30

w5mm avatar Nov 04 '24 09:11 w5mm

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-ui-bot[bot] avatar Nov 04 '24 09:11 taro-ui-bot[bot]

出问题的代码行

Snipaste_2024-11-04_17-43-31

w5mm avatar Nov 04 '24 09:11 w5mm

@robinv8 我只用 Taro 4 没用 Taro UI,在条件渲染时会报一样的错误:

<>
    {session && (
        <ul>
            <li>昵称:{session.nickName as string}</li>
            <li>手机:{session.mobilePhone as string}</li>
            <li>微信 OpenID:{session.wechatId as string}</li>
        </ul>
    )}
</>
taro.js:593 TypeError: u.contains is not a function
    at I ([email protected]_node_modules_preact_dist_preact.module.js:2)
    at S ([email protected]_node_modules_preact_dist_preact.module.js:2)
    at O ([email protected]_node_modules_preact_dist_preact.module.js:2)
    at P ([email protected]_node_modules_preact_dist_preact.module.js:2)

改为普通渲染就好了:

<>
    <ul>
        <li>昵称:{session?.nickName as string}</li>
        <li>手机:{session?.mobilePhone as string}</li>
        <li>微信 OpenID:{session?.wechatId as string}</li>
    </ul>
</>

TechQuery avatar May 01 '25 13:05 TechQuery