<!DOCTYPE html>
<html>
<template id="vnode">
<div>我是template</div>
</template>
<script type="text/javascript"></script>
//<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.0-beta.7/vue.cjs.js"></script>
<script>
function render(vnode, container) {
const el = document.createElement(vnode.tag)
for (const key in vnode.props) {
if(/^on/.test(key)) {
el.addEventListener(
key.substre(2).toLowerCase(),
vnode.props[key]
)
}
}
if (typeof vnode.children === 'string') {
el.appendChild(document.createTextNode(vnode.children))
} else if (Array.isArray(vnode.children)) {
vnode.children.forEach(child => renderer(chind, el))
}
container.appendChild(el)
}
</script>
</html>