• Shallow version of ().

    Unlike (), there is no deep conversion: only root-level properties are made readonly. Property values are stored and exposed as-is - this also means properties with ref values will not be automatically unwrapped.

    Type Parameters

    • T extends object

    Parameters

    • target: T

      The source object.

    Returns Readonly<T>

    const state = shallowReadonly({
    foo: 1,
    nested: {
    bar: 2
    }
    })

    // mutating state's own properties will fail
    state.foo++

    // ...but works on nested objects
    isReadonly(state.nested) // false

    // works
    state.nested.bar++

    https://vuejs.org/api/reactivity-advanced.html#shallowreadonly