• Preparing search index...
  • The search index is not available
Yank Note Api - v3.82.1
  • Yank Note Api
  • renderer/context/lib
  • vue
  • computed

Function computed

  • computed<T>(getter, debugOptions?): ComputedRef<T>
  • Takes a getter function and returns a readonly reactive ref object for the returned value from the getter. It can also take an object with get and set functions to create a writable ref object.

    Type Parameters

    • T

    Parameters

    • getter: ComputedGetter<T>

      Function that produces the next value.

    • OptionaldebugOptions: DebuggerOptions

      For debugging. See https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging.

    Returns ComputedRef<T>

    Example

    // Creating a readonly computed ref:
    const count = ref(1)
    const plusOne = computed(() => count.value + 1)

    console.log(plusOne.value) // 2
    plusOne.value++ // error
    // Creating a writable computed ref:
    const count = ref(1)
    const plusOne = computed({
    get: () => count.value + 1,
    set: (val) => {
    count.value = val - 1
    }
    })

    plusOne.value = 1
    console.log(count.value) // 0

    See

    https://vuejs.org/api/reactivity-core.html#computed

    • Defined in node_modules/@vue/runtime-core/dist/runtime-core.d.ts:6
  • computed<T, S>(options, debugOptions?): WritableComputedRef<T, S>
  • Type Parameters

    • T
    • S = T

    Parameters

    • options: WritableComputedOptions<T, S>
    • OptionaldebugOptions: DebuggerOptions

    Returns WritableComputedRef<T, S>

    • Defined in node_modules/@vue/runtime-core/dist/runtime-core.d.ts:6

Settings

Member Visibility
Yank Note Api - v3.82.1
  • Loading...

Generated using TypeDoc