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

[DateTimePicker] Cannot read property 'extend' of undefined(疑似 dayjs 加载错误) #3510

Closed
0604hx opened this issue Mar 3, 2025 · 3 comments
Labels
question This is a question, not a bug

Comments

@0604hx
Copy link

0604hx commented Mar 3, 2025

tdesign-miniprogram 版本

1.8.6

重现链接

No response

重现步骤

  1. json 中引入组件
{
    "usingComponents": {
        "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
    }
}
  1. 脚本文件定义数据
Page({
    data: {
        expireShow: false,
        expireDate: 0,
    }
})
  1. 在页面中使用
<!--报错:Cannot read property 'extend' of undefined,疑似无法引入 dayjs-->
<t-date-time-picker auto-close title="选择日期" visible="{{ expireShow }}" mode="date" default-value="{{expireDate}}" format="YYYY-MM-DD" /> 

错误信息

页面【miniprogram_npm/tdesign-miniprogram/date-time-picker/date-time-picker]错误:
 TypeError: Cannot read property 'extend' of undefined
    at date-time-picker.js? [sm]:14
    at WASubContext.js?t=wechat&s=1740980238658&v=3.6.6:1

Image

期望结果

能够在小程序中正常使用时间选择组件。

实际结果

No response

基础库版本

3.6.6

补充说明

我的小程序依赖如下:

{
    "author": "0604hx/集成显卡",
    "license": "MIT",
    "dependencies": {
        "dayjs": "^1.11.13",
        "tdesign-miniprogram": "^1.8.6"
    }
}

dayjs 用于日期格式化,在 util 中能够正常引入并使用。

Copy link
Contributor

github-actions bot commented Mar 3, 2025

👋 @0604hx,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@anlyyao
Copy link
Collaborator

anlyyao commented Mar 3, 2025

@0604hx 官网贴了示例代码片段,组件使用上可以参考示例代码片段,

Image

@anlyyao anlyyao added the question This is a question, not a bug label Mar 3, 2025
@0604hx
Copy link
Author

0604hx commented Mar 3, 2025

感谢,已经解决。
错误的原因是因为勾选了详情->本地设置->使用 SWC 编译脚本文件,去除该选项重新编译就正常了🤝

@0604hx 0604hx closed this as completed Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question, not a bug
Projects
None yet
Development

No branches or pull requests

2 participants