Home / Function/ render() — vue Function Reference

render() — vue Function Reference

Architecture documentation for the render() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  31cd301c_a88b_c811_2866_b3d6f4b7a004["render()"]
  026cfe7c_3b65_a277_dd1c_866e5ce8b6df["createRenderer()"]
  026cfe7c_3b65_a277_dd1c_866e5ce8b6df -->|calls| 31cd301c_a88b_c811_2866_b3d6f4b7a004
  d9b4566f_74ea_db87_d004_22dccd0797b4["renderResourceHints()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004 -->|calls| d9b4566f_74ea_db87_d004_22dccd0797b4
  1fb5bb9f_cd65_3295_c809_a55c72d7282e["renderStyles()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004 -->|calls| 1fb5bb9f_cd65_3295_c809_a55c72d7282e
  e403fe42_26ea_b8a9_bdf7_968ad8b3c29d["renderState()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004 -->|calls| e403fe42_26ea_b8a9_bdf7_968ad8b3c29d
  d6d15699_35ef_8f3d_355a_501bf0e3ca26["renderScripts()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004 -->|calls| d6d15699_35ef_8f3d_355a_501bf0e3ca26
  style 31cd301c_a88b_c811_2866_b3d6f4b7a004 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/template-renderer/index.ts lines 107–141

  render(
    content: string,
    context: Record<string, any> | null
  ): string | Promise<string> {
    const template = this.parsedTemplate
    if (!template) {
      throw new Error('render cannot be called without a template.')
    }
    context = context || {}

    if (typeof template === 'function') {
      return template(content, context)
    }

    if (this.inject) {
      return (
        template.head(context) +
        (context.head || '') +
        this.renderResourceHints(context) +
        this.renderStyles(context) +
        template.neck(context) +
        content +
        this.renderState(context) +
        this.renderScripts(context) +
        template.tail(context)
      )
    } else {
      return (
        template.head(context) +
        template.neck(context) +
        content +
        template.tail(context)
      )
    }
  }

Subdomains

Called By

Frequently Asked Questions

What does render() do?
render() is a function in the vue codebase.
What does render() call?
render() calls 4 function(s): renderResourceHints, renderScripts, renderState, renderStyles.
What calls render()?
render() is called by 1 function(s): createRenderer.

Analyze Your Own Codebase

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

Try Supermodel Free