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

[Fixed Bug] argument undefined in function call of scoped slot #2

Open
csechuan opened this issue Aug 1, 2021 · 3 comments
Open

[Fixed Bug] argument undefined in function call of scoped slot #2

csechuan opened this issue Aug 1, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@csechuan
Copy link

csechuan commented Aug 1, 2021

Facing some issue when running this compiler in Nuxt. Trying to call a function on click of a component, but unable to retrieve the argument.

<component @click.prevent(greet('hello'))>

methods: {
greet(message) {
console.log(message) // return undefined
}
}

@JuniorTour
Copy link
Owner

As far as I konw,

First, you should use click listener with ="method", just like below, according to vue.js Document

  <div @click.prevent="greet('hello')">worked</div>

Then it will work as you expect, get your param:
0PYR) R)Q{BZYKVSFB5SQ1Y

Second, if you are using event listener of component, the usage is different, please refre to Listening to Child Components Events

Hope my reply is helpeful, Thank you for your feedback~

@csechuan
Copy link
Author

csechuan commented Aug 1, 2021

I am using bootstrap-vue table. It behaves weirdly if i use this compiler.

<b-table :items="items">
  <template #cell(more)="{ item }">
    <b-button @click.prevent="greet(item)">test</b-button>  <!-- item is undefined -->
    <b-link :to="getLink(item)"></b-link> <!-- item is NOT undefined and has values -->
  </template>
</b-table>

But when i run the above code without this compiler, it just works fine.

@JuniorTour
Copy link
Owner

@csechuan It is a bug, I've published a new version 1.0.1 to fix.

You can try it by:

npm install [email protected] -D
// or yarn
yarn add [email protected] -D

U{3IWFA3A~WP84Y8YL @{YA

Thank you for your feedback!

@JuniorTour JuniorTour changed the title argument undefined in function call [BUG fixed] argument undefined in function call of scoped slot Aug 8, 2021
@JuniorTour JuniorTour added the bug Something isn't working label Aug 8, 2021
@JuniorTour JuniorTour changed the title [BUG fixed] argument undefined in function call of scoped slot [Fixed BUG] argument undefined in function call of scoped slot Sep 3, 2021
@JuniorTour JuniorTour changed the title [Fixed BUG] argument undefined in function call of scoped slot [Fixed Bug] argument undefined in function call of scoped slot Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants