当前位置: 首页 > 工具软件 > Eva.js > 使用案例 >

Uncaught ReferenceError: exports is not defined at vue.cjs.js:3:23

松秦斩
2023-12-01
<!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>


 类似资料: