Skip to content

select,date-picker,month-picker,range-picker,week-picker 在自定义指令中绑定change 事件不生效 #2031

@JinPengGeng

Description

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

Version

2.0.0 及 1.5.1等以前版本,我只试到了1.4

Environment

os: win10, npm: 6.12.1 @vue/cli: 4.2.3, brower: chrome 78.0.3904.97(Official Build) (64 ビット)

Reproduction link

Edit on CodeSandbox

Steps to reproduce

参考 重现链接

What is expected?

自定义指令绑定事件,正常生效

What is actually happening?

自定义指令绑定事件,没有效果


场景:自定义指令实现所有 validation check统一管理,通过配置文件进行集成,同时绑定触发事件(change、blur...)和 触发参数

eg: v-validate.change="'xxx'"

目前测试结果:
input 、checkbox,checkbox group 绑定正常
select、所有日期相关(date-picker)等绑定失败

临时解决方案:

node_modules\ant-design-vue\es\select\index.js

L119-L122 =>

// FIXME: fire change for select component
fireChange: function fireChange(value) {
    this.$emit('change', value);
},

L253-L257 =>

// FIXME: fire change for select component
// on: getListeners(this),
on:_extends({}, getListeners(this), {
    change: this.fireChange
}),

node_modules\ant-design-vue\es\date-picker\wrapPicker.js

L104-L107 =>

// FIXME: fire change for select component
fireChange: function fireChange(e) {
    this.$emit('change', arguments[0], arguments[1]);
},

L196-L197 =>

// FIXME: fire change for select component
change: this.fireChange,

希望作者大大能够官方提供事件穿透 :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions