JSFiddle - React, Tailwind, and code Playground
by gander
HTML
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<div id="foo">EXAMPLE #1</div>
<div id="bar" data-firstname="Evan" data-lastname="You">EXAMPLE #2</div>
JavaScript
function initApp(root) {
Vue.createApp({
props: {
firstname: {
type: String,
default: 'John'
},
lastname: {
type: String,
default: 'Doe'
}
},
template: '{{ firstname }} {{ lastname }}'
}, root.dataset).mount(root);
}
initApp(document.getElementById('foo'));
initApp(document.getElementById('bar'));