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 |
|
| 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,
|
...DatePicker.props,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
// @exposed-api
|
||||||
|
getPicker() {
|
||||||
|
return this.$refs.root.getPicker();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const Component = this.type === 'time' ? TimePicker : DatePicker;
|
const Component = this.type === 'time' ? TimePicker : DatePicker;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
|
ref="root"
|
||||||
class={bem()}
|
class={bem()}
|
||||||
{...{
|
{...{
|
||||||
props: this.$props,
|
props: this.$props,
|
||||||
|
@ -30,3 +30,8 @@ test('time type', () => {
|
|||||||
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getPicker method', () => {
|
||||||
|
const wrapper = mount(DatetimePicker);
|
||||||
|
expect(wrapper.vm.getPicker()).toBeTruthy();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user