SHARE
TWEET

Untitled

a guest Aug 18th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export const vnodeRender = {
  2.   methods: {
  3.     vnodeRender(vnode) {
  4.       if (process.browser) {
  5.         if (!vnode.tag) {
  6.           return document.createTextNode(vnode.text)
  7.         }
  8.         const el = document.createElement(vnode.tag)
  9.         if (vnode.data) {
  10.           if (vnode.data.staticClass) {
  11.             el.setAttribute('class', vnode.data.staticClass)
  12.           }
  13.           if (vnode.data.attrs) {
  14.             Object.keys(vnode.data.attrs)
  15.               .forEach((key) => {
  16.                 el.setAttribute(key, vnode.data.attrs[key])
  17.               })
  18.           }
  19.         }
  20.         if (vnode.children) {
  21.           vnode.children.forEach((child) => {
  22.             el.appendChild(this.vnodeRender(child))
  23.           })
  24.         }
  25.         return el
  26.       }
  27.     }
  28.   }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top