[Vuejs]-Reactivity for Vue props that are objects

0👍

With Typescript you could do something like this:

export class YourProp {
    constructor(
        public value: YourValue
    )
}

export class YourValue {
    constructor (
        public columnName: String,
        public anotherAttr: String = "default" // give it a default value since its optional
)

And then don’t handle the prop as an Object but as an instance of YourProp.

Leave a comment