vitogit / vue-chessboard

Chessboard vue component to load positions, create positions and see threats
http://vitomd.com/vue-chessboard-examples/
GNU General Public License v3.0
165 stars 49 forks source link

Working example for hooks in browser #39

Open bmacho opened 2 years ago

bmacho commented 2 years ago

Hey!

Can you provide a working example for hooks for the browser version?

I'm trying things like


<html>

    <head>
        <link rel="stylesheet" href="dist/vue-chessboard.css"/>
        <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
        <script src="dist/vue-chessboard.browser.js"></script>
    </head>

    <body>

        <div id="app">

          <chessboard @onMove="showInfo"/> 

         <div>
                {{this.positionInfo}}
        </div>

        </div>

        <script>

        var sI = function (data) {
            this.positionInfo = data
        }

        new Vue({
          el: '#app',
          components: {
            VueChessboard
          },
          data: {
            showInfo: sI
          }  

        });
        </script>

    </body>

</html>

and variants, but nothing seems working, can't even pass a console.log or an alert.

Also, is there a list for available hooks?

Thank you,