vuejs / babel-plugin-transform-vue-jsx

babel plugin for vue 2.0 jsx
1.85k stars 132 forks source link

how to write the arguments of the custom directives? #193

Closed JE-lee closed 4 years ago

JE-lee commented 4 years ago

when i use the vue template like below, it works fine with the argument '#srcoll-target'

<v-container id="scroll-target" style="max-height: 400px" >
      <v-row
        v-scroll:#scroll-target="handleScroll"
        style="height: 1000px"
      ></v-row>
</v-container>

unfortunately, it can't work with the another way in jsx。 I'm sure about that the problem is the wrong delivering the arguments. is it true ? or how can i transmit the arguments 0f directives in perspective. thank you

 const directives= [
      {
        name: 'scroll',
        value: this.handleScroll.bind(this),
        arguments: {
          ['#scroll-target']: true
        }
      }
 ];
<v-container id="scroll-target" style="max-height: 400px" >
      <v-row
        {...{ directives }}
        style="height: 1000px"
      ></v-row>
</v-container>
haoqunjiang commented 4 years ago

See https://template-explorer.vuejs.org/#%3Cv-row%0A%20%20v-scroll%3A%23scroll-target%3D%22handleScroll%22%0A%20%20style%3D%22height%3A%201000px%22%0A%3E%3C%2Fv-row%3E%0A

haoqunjiang commented 4 years ago

It should be arg: "#scroll-target" rather than arguments: { ['#scroll-target']: true }