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

element UI date组件报错 #86

Open
health901 opened this issue Aug 8, 2024 · 0 comments
Open

element UI date组件报错 #86

health901 opened this issue Aug 8, 2024 · 0 comments

Comments

@health901
Copy link

复现版本 2.1.0, 2.0.9

TypeError: s.getTime is not a function
    at Object.date [as validator] (index.js:1:436495)
    at index.js:1:440259
    at o (index.js:1:429962)
    at Ys (index.js:1:429979)
    at index.js:1:430313
    at Array.forEach (<anonymous>)
    at Ks (index.js:1:430264)
    at la.validate (index.js:1:439172)
    at a.validate (index.js:1:444869)
    at a.n [as validate] (vue.min.js:6:1166)

demo里加上 Elm::date('date', '时间')->required(), 即可复现, 不设置required不会报错

date值变动时,会调用element的这个函数, 此时date控件的值是字符串形式的日期格式, 调用getTime()失败

            date: function(e, t, n, i, r) {
                var o = [];
                if (e.required || !e.required && i.hasOwnProperty(e.field)) {
                    if (qs(t) && !e.required)
                        return n();
                    if (na.required(e, t, i, o, r),
                    !qs(t)) {
                        var s = void 0;
                        s = "number" == typeof t ? new Date(t) : t,
                        na.type(e, s, i, o, r),
                        s && na.range(e, s.getTime(), i, o, r)
                    }
                }
                n(o)
            },

element-ui库更新至[email protected],问题依然存在

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant