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

自定义组件 on-change 事件不能触发? #35

Closed
Dreampie opened this issue Mar 31, 2015 · 2 comments
Closed

自定义组件 on-change 事件不能触发? #35

Dreampie opened this issue Mar 31, 2015 · 2 comments

Comments

@Dreampie
Copy link

//组件 input
on-change="{this.$emit('change', start)}"


//使用组件
on-change={this.selectMonth($event)}
@leeluolee
Copy link
Member

完整的代码?,

按你的代码应该是没问题的. 比如Pager组件内部

<input on-change={this.$emit('change', seleted)}> 

在别的组件内嵌它

<pager on-change={this.seletecMonth($event)} > 

多余的引号可以去掉

@Dreampie
Copy link
Author

<input
    type="text" ref="start" placeholder="Search start month..." readonly="readonly"
    on-change="{this.$emit('change', start)}"
>

<app-datepicker state={@(this.$state)} config="{config}" searchState={fileState} on-change={this.selectMonth($event)}></app-datepicker>

//插件内部使用了datepicker,通过change事件触发

$(component.$refs.start).datepicker(
        component.data.config
      ).on("changeDate", (e)->
        if(component.data.end < $(e.target).val())
          component.data.searchState.error = true
        else
          component.data.searchState.error = false
        component.data.start = $(e.target).val()
        $(e.target).change()
      )
selectMonth: (month)->
  component = this
  component.data.fileMonth = month
  component.data.fileState.error = false

selectMonth 没有执行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants