Skip to content

Instantly share code, notes, and snippets.

@monbang
Created March 31, 2020 11:14
Show Gist options
  • Save monbang/5f9dd073fc82475789330e94559865a3 to your computer and use it in GitHub Desktop.
Save monbang/5f9dd073fc82475789330e94559865a3 to your computer and use it in GitHub Desktop.
alpine-1
<div x-data="{ count: 0 }">
<button @click="count++">+</button>
<button @click="count--">-</button>
<span x-text="count"></span>
</div>
let dataString = document.querySelector('[x-data]').getAttribute('x-data');
let data = eval(`(${dataString})`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment