We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ngx-weui是用npm安装的,版本为1.0.8,浏览器是Chrome 这是我使用DatePicker的代码
ngx-weui是用npm安装的,版本为1.0.8,浏览器是Chrome
<weui-date-picker type="date" [(ngModel)]="event.expTime" name="expTime"></weui-date-picker>
在使用DatePicker时,遇到一个问题 追踪到代码里,是picker-data.component.js文件72行,this._value没有getFullYear()等Date对象才有的方法。我打印了this._value,值为2017-07-13。问题在于这里的this._value不是Date对象,而是一个字符串。将62行代码改成
if (!this._value) this._value = new Date(); else this._value = new Date(this._value)
即可解决问题。但是我不知道这里为什么会出现这个问题。
同时还发现了另外一个问题: 我的代码里使用了ngIf来控制DatePicker的显示和隐藏。其中一个功能是当选中一个选项,DatePicker才会出现,但是这里也会出错,我看了一下,拿到的this._value是0000-00-00,这是一个无效的Date。导致出错。
最后找到215行:
DatePickerComponent.prototype.writeValue = function (value) { if (value) { this._value = value; this.genGroups(); } };
这里的this._value拿到的就一直是字符串(包括非法的时间字符串),但是我不知道这个方法是什么时候调用的。
The text was updated successfully, but these errors were encountered:
抱歉,我才发现我传进去的就是字符串,不是组件的问题,好久之前的代码,临时改成DatePicker,结果给忘了。尴尬!!!
Sorry, something went wrong.
No branches or pull requests
ngx-weui是用npm安装的,版本为1.0.8,浏览器是Chrome
这是我使用DatePicker的代码
在使用DatePicker时,遇到一个问题
追踪到代码里,是picker-data.component.js文件72行,this._value没有getFullYear()等Date对象才有的方法。我打印了this._value,值为2017-07-13。问题在于这里的this._value不是Date对象,而是一个字符串。将62行代码改成
即可解决问题。但是我不知道这里为什么会出现这个问题。
同时还发现了另外一个问题:
我的代码里使用了ngIf来控制DatePicker的显示和隐藏。其中一个功能是当选中一个选项,DatePicker才会出现,但是这里也会出错,我看了一下,拿到的this._value是0000-00-00,这是一个无效的Date。导致出错。
最后找到215行:
这里的this._value拿到的就一直是字符串(包括非法的时间字符串),但是我不知道这个方法是什么时候调用的。
The text was updated successfully, but these errors were encountered: