Home / Function/ genClassForVnode() — vue Function Reference

genClassForVnode() — vue Function Reference

Architecture documentation for the genClassForVnode() function in class.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  0aadb7c7_a6a0_f3b6_4c02_cbb61937a073["genClassForVnode()"]
  5b855538_2046_796e_16f9_7327a61399cb["isDef()"]
  0aadb7c7_a6a0_f3b6_4c02_cbb61937a073 -->|calls| 5b855538_2046_796e_16f9_7327a61399cb
  f18e4915_ce62_eedd_9bcb_25dda9b2b36d["mergeClassData()"]
  0aadb7c7_a6a0_f3b6_4c02_cbb61937a073 -->|calls| f18e4915_ce62_eedd_9bcb_25dda9b2b36d
  36937816_dc6e_5dbf_7567_a748aa0481ba["renderClass()"]
  0aadb7c7_a6a0_f3b6_4c02_cbb61937a073 -->|calls| 36937816_dc6e_5dbf_7567_a748aa0481ba
  style 0aadb7c7_a6a0_f3b6_4c02_cbb61937a073 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/platforms/web/util/class.ts lines 5–22

export function genClassForVnode(vnode: VNodeWithData): string {
  let data = vnode.data
  let parentNode: VNode | VNodeWithData | undefined = vnode
  let childNode: VNode | VNodeWithData = vnode
  while (isDef(childNode.componentInstance)) {
    childNode = childNode.componentInstance._vnode!
    if (childNode && childNode.data) {
      data = mergeClassData(childNode.data, data)
    }
  }
  // @ts-expect-error parentNode.parent not VNodeWithData
  while (isDef((parentNode = parentNode.parent))) {
    if (parentNode && parentNode.data) {
      data = mergeClassData(data, parentNode.data)
    }
  }
  return renderClass(data.staticClass!, data.class)
}

Domain

Subdomains

Frequently Asked Questions

What does genClassForVnode() do?
genClassForVnode() is a function in the vue codebase.
What does genClassForVnode() call?
genClassForVnode() calls 3 function(s): isDef, mergeClassData, renderClass.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free