Created
March 28, 2022 22:48
-
-
Save reyaz/99f7904500148bb5061510a847859109 to your computer and use it in GitHub Desktop.
Untitled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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