Home / Function/ transformModel() — vue Function Reference

transformModel() — vue Function Reference

Architecture documentation for the transformModel() function in create-component.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  7c4e5e26_419d_df68_b5f0_b8c2ea0ee7c3["transformModel()"]
  97ceaa96_dc73_11db_99c0_3dfa1b31b53f["createComponent()"]
  97ceaa96_dc73_11db_99c0_3dfa1b31b53f -->|calls| 7c4e5e26_419d_df68_b5f0_b8c2ea0ee7c3
  style 7c4e5e26_419d_df68_b5f0_b8c2ea0ee7c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/vdom/create-component.ts lines 257–275

function transformModel(options, data: any) {
  const prop = (options.model && options.model.prop) || 'value'
  const event = (options.model && options.model.event) || 'input'
  ;(data.attrs || (data.attrs = {}))[prop] = data.model.value
  const on = data.on || (data.on = {})
  const existing = on[event]
  const callback = data.model.callback
  if (isDef(existing)) {
    if (
      isArray(existing)
        ? existing.indexOf(callback) === -1
        : existing !== callback
    ) {
      on[event] = [callback].concat(existing)
    }
  } else {
    on[event] = callback
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does transformModel() do?
transformModel() is a function in the vue codebase.
What calls transformModel()?
transformModel() is called by 1 function(s): createComponent.

Analyze Your Own Codebase

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

Try Supermodel Free