vue-template-babel-compiler
vue-template-babel-compiler copied to clipboard
[Fixed Bug] argument undefined in function call of scoped slot
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 } }
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:
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~
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.
@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
Thank you for your feedback!