0👍
✅
If you take a look at this JSFiddle, you’ll see your code work as intended (or atleast how I understood it). The main issue was that you were creating the array of tiles
with generic objects. These objects don’t automatically transform to truchet-tiles
with the needed properties.
What needed to be done was passing the properties to each instance of truchet-tile
. Next thing what needed to be done was to move the v-on:click
handler. You want the rotate
method to fire when a user clicks on the truchet-tile
. But since an instance of truchet-tile
eventually becomes an img
(because of the template
attribute), we need the handler on this img
instead.
If you have any more questions, feel free to ask
Source:stackexchange.com