vimeshjs / vimesh-ui

Vimesh UI is an ultra lightweight library to build UI components for Alpine.js
MIT License
125 stars 5 forks source link

Event listener doubled #19

Closed kamcio181 closed 5 months ago

kamcio181 commented 5 months ago

Hello I am using html like below. Click listener on button is registered twice if I use 'unwrap' on outer component. Could you help me solve the issue?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ScoreBoard</title>
    <script src="https://unpkg.com/@vimesh/ui"></script>
    <script src="https://unpkg.com/alpinejs" defer></script>
</head>
<body class="w-screen h-screen" x-data>
    <vui-outer></vui-outer>

    <template x-component.unwrap="button">
        <button type="button"><slot></slot></button>
    </template>

    <template x-component.unwrap="outer">
        <div>
            <vui-button @click.stop="console.log('clicked')">Click me</vui-button>
        </div>
    </template>
</body>
</html>
xinjie-zhang commented 5 months ago

It is fixed in the latest version.

kamcio181 commented 5 months ago

Great, thanks