ef.js Click Count Demo
by Yukino Song
HTML
<script src="https://cdn.jsdelivr.net/npm/ef.js@latest"></script>
JavaScript
new ef.t`
>button
@click = add
.You have clicked {{count}} time{{s}}.
`({
$data: {count: 0},
$methods: {
add({state}) {
state.$data.count += 1
if (state.$data.count > 1) state.$data.s = 's'
}
}
}).$mount({target: document.body})