Home / Function/ del() — vue Function Reference

del() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ae862206_ea75_d74f_fad1_4801b0c9439c["del()"]
  af395f8e_1ac5_a239_71b7_fd29a1c03d2c["index.ts"]
  ae862206_ea75_d74f_fad1_4801b0c9439c -->|defined in| af395f8e_1ac5_a239_71b7_fd29a1c03d2c
  98344c54_4454_3804_84b6_6f45b28782b9["notify()"]
  ae862206_ea75_d74f_fad1_4801b0c9439c -->|calls| 98344c54_4454_3804_84b6_6f45b28782b9
  style ae862206_ea75_d74f_fad1_4801b0c9439c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/observer/index.ts lines 283–323

export function del(target: any[] | object, key: any) {
  if (__DEV__ && (isUndef(target) || isPrimitive(target))) {
    warn(
      `Cannot delete reactive property on undefined, null, or primitive value: ${target}`
    )
  }
  if (isArray(target) && isValidArrayIndex(key)) {
    target.splice(key, 1)
    return
  }
  const ob = (target as any).__ob__
  if ((target as any)._isVue || (ob && ob.vmCount)) {
    __DEV__ &&
      warn(
        'Avoid deleting properties on a Vue instance or its root $data ' +
          '- just set it to null.'
      )
    return
  }
  if (isReadonly(target)) {
    __DEV__ &&
      warn(`Delete operation on key "${key}" failed: target is readonly.`)
    return
  }
  if (!hasOwn(target, key)) {
    return
  }
  delete target[key]
  if (!ob) {
    return
  }
  if (__DEV__) {
    ob.dep.notify({
      type: TriggerOpTypes.DELETE,
      target: target,
      key
    })
  } else {
    ob.dep.notify()
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does del() do?
del() is a function in the vue codebase, defined in src/core/observer/index.ts.
Where is del() defined?
del() is defined in src/core/observer/index.ts at line 283.
What does del() call?
del() calls 1 function(s): notify.

Analyze Your Own Codebase

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

Try Supermodel Free