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

DatePicker, RangePicker Cannot read property 'key' of undefined #457

Closed
1 task done
koaqiu opened this issue Jan 31, 2019 · 8 comments
Closed
1 task done

DatePicker, RangePicker Cannot read property 'key' of undefined #457

koaqiu opened this issue Jan 31, 2019 · 8 comments
Labels

Comments

@koaqiu
Copy link

koaqiu commented Jan 31, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.3

Environment

win10,vue:2.5.21

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

添加到页面

<a-date-picker @change="onChangeDate" key="date-picker"/>

然后点击 控件选择日期

What is expected?

正常弹出日期选择框

What is actually happening?

无法选择日期,并且报错:RangePicker Cannot read property 'key' of undefined

https://boomdaily.oss-cn-shanghai.aliyuncs.com/tmp/20190131091606.png

@tangjinzhou
Copy link
Member

使用这个https://codesandbox.io/s/2wpk21kzvr 提供复现demo 谢谢

@koaqiu
Copy link
Author

koaqiu commented Jan 31, 2019

@tangjinzhou
我上传了一个
https://codesandbox.io/s/3x37pwv5np 这里好像运行不了 TypeScript项目

也上传到这里了
https://github.com/koaqiu/test-ant-design-vue

@koaqiu
Copy link
Author

koaqiu commented Jan 31, 2019

@tangjinzhou 另外 现在这个组件对 TypeScript 支持不好
这也是 在 TypeScript 下出现的问题
#452

@tangjinzhou
Copy link
Member

class component的使用方式不对,https://github.com/vuejs/vue-class-component

<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'

@Component
export default class App extends Vue {
}
</script>

@koaqiu
Copy link
Author

koaqiu commented Jan 31, 2019

@tangjinzhou 我的代码是vue-cli自动生成的,用的是import { Component, Prop, Vue } from 'vue-property-decorator';
我按你说的改了,可以了

谢谢了。

@koaqiu koaqiu closed this as completed Jan 31, 2019
@tangjinzhou
Copy link
Member

import { Component, Prop, Vue } from 'vue-property-decorator';
也可以,没有问题,你的问题是没有使用 @Component 修饰

@gouflv
Copy link

gouflv commented Apr 16, 2019

遇到同样的坑,找了半天才发现有个模块忘了写修饰

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants