Skip to content

Support on={this.$listeners} #153

Open
@voluntadpear

Description

@voluntadpear

I'm not exactly sure if my intuition is OK but I was trying to pass the $listeners property to a specific element of my component doing this:

render () {
<div
  on={this.$listeners}
/>
}

And my app breaks with this:

Module build failed: TypeError: /Users/guille/Documents/vue-test/packages/dialog/src/index.js: Cannot read property 'toLowerCase' of undefined
    at groupEventAttributes (/Users/guille/Documents/vue-test/node_modules/babel-plugin-jsx-event-modifiers/dist/bundle.js:34:30)
    at Array.reduce (<anonymous>)

I did what was proposed on #86 and it works:

render () {
const attributes = {on: this.$listeners}

  <div
    {...attributes}
  />
}

Shouldn't we support the syntax of my first attempt?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions