Handling events in Marko.js is straightforward. You can use the on- prefix to attach event handlers. Here's an example:
<template>
<button on-click('handleClick')>Click me</button>
</template>
<script>
module.exports = class {
handleClick() {
console.log('Button clicked!');
}
};
</script>
In this example, clicking the button will trigger the handleClick method, logging a message to the console.