mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(DatetimePicker): getPicker method not work (#5710)
This commit is contained in:
parent
7cc887a20c
commit
e48e5d47cd
@ -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 | - | - |
|
||||
|
@ -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) | - | - |
|
||||
|
||||
## 常见问题
|
||||
|
||||
|
@ -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,
|
||||
|
@ -30,3 +30,8 @@ test('time type', () => {
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('getPicker method', () => {
|
||||
const wrapper = mount(DatetimePicker);
|
||||
expect(wrapper.vm.getPicker()).toBeTruthy();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user