Skip to content

Instantly share code, notes, and snippets.

@reyaz
Created March 28, 2022 22:48
Show Gist options
  • Save reyaz/99f7904500148bb5061510a847859109 to your computer and use it in GitHub Desktop.
Save reyaz/99f7904500148bb5061510a847859109 to your computer and use it in GitHub Desktop.
Untitled
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Untitled</title>
</head>
<body>
<div data-v-component="search"></div>
<script src="https://unpkg.com/vue@3"></script>
<script>
const { createApp } = Vue
const SearchComponent = {
data () {
return {}
},
template: 'search'
}
const component_map = new Map()
component_map.set('search', SearchComponent)
document.querySelectorAll('[data-v-component]').forEach(e => {
const component_key = e.getAttribute('data-v-component')
const component = component_map.get(component_key)
if (component) createApp(component, { ...e.dataset }).mount(e)
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment