fix(DatetimePicker): getPicker method not work (#5710)

This commit is contained in:
陈嘉涵 2020-02-22 17:55:05 +08:00
parent 7cc887a20c
commit e48e5d47cd
4 changed files with 15 additions and 2 deletions

View File

@ -197,4 +197,4 @@ Use [ref](https://vuejs.org/v2/api/#ref) to get DatetimePicker instance and call
| Name | Description | Attribute | Return value |
|------|------|------|------|
| getPicker `v2.4.0` | get Picker instance | - | - |
| getPicker `v2.5.3` | get Picker instance | - | - |

View File

@ -201,7 +201,7 @@ export default {
| 方法名 | 说明 | 参数 | 返回值 |
|------|------|------|------|
| getPicker `v2.4.0` | 获取 Picker 实例,用于调用 Picker 的[实例方法](#/zh-CN/picker#fang-fa) | - | - |
| getPicker `v2.5.3` | 获取 Picker 实例,用于调用 Picker 的[实例方法](#/zh-CN/picker#fang-fa) | - | - |
## 常见问题

View File

@ -10,11 +10,19 @@ export default createComponent({
...DatePicker.props,
},
methods: {
// @exposed-api
getPicker() {
return this.$refs.root.getPicker();
},
},
render() {
const Component = this.type === 'time' ? TimePicker : DatePicker;
return (
<Component
ref="root"
class={bem()}
{...{
props: this.$props,

View File

@ -30,3 +30,8 @@ test('time type', () => {
expect(wrapper).toMatchSnapshot();
});
test('getPicker method', () => {
const wrapper = mount(DatetimePicker);
expect(wrapper.vm.getPicker()).toBeTruthy();
});