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
  d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b["render()"]
  0ef8eb2c_b0fb_7608_a58e_c6b068a0d511["createRenderer()"]
  0ef8eb2c_b0fb_7608_a58e_c6b068a0d511 -->|calls| d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b
  7f02213e_fb34_2058_966a_5fea6f3a95d9["renderResourceHints()"]
  d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b -->|calls| 7f02213e_fb34_2058_966a_5fea6f3a95d9
  6465c79a_4c76_b386_0000_61f8658631f6["renderStyles()"]
  d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b -->|calls| 6465c79a_4c76_b386_0000_61f8658631f6
  2db55f9f_d6b9_466e_41e7_5872bfa09b6d["renderState()"]
  d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b -->|calls| 2db55f9f_d6b9_466e_41e7_5872bfa09b6d
  48333725_76cd_922c_8337_a788ad586e3e["renderScripts()"]
  d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b -->|calls| 48333725_76cd_922c_8337_a788ad586e3e
  style d00ee0bd_5dce_cc55_ebbd_75e9b4ae547b 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