Home > front end >  Vue3 typescript has no, initializer assignand is not definiteled y in the const an error
Vue3 typescript has no, initializer assignand is not definiteled y in the const an error

Time:10-02

 
@ Prop (} {required: false) bgcColor: string;//background color
@ Prop (} {required: false) tipSize: number;//pop-up box size


The error, have bosses to solve it for me??

CodePudding user response:

Give it a default value

CodePudding user response:



After the assignment at the wrong

CodePudding user response:

 
@ Prop (} {required: false) bgcColor: string='black';//background color
@ Prop (} {required: false) tipSize: number=10;//pop-up box size


Is a problem with my assignment?

CodePudding user response:

Const constants can't copy, unless it is object

CodePudding user response:

refer to the second floor is fishing in _ fishing response:


After the assignment at the wrong

Did you change bgColor value in the child components, don't change the value of the Prop in the child component