0

My Vue version is 2.6.14, and the vue-property-decorator version is 9.1.2. Yesterday, I upgraded vue-cli 3 to version 4 using vue upgrade. Previously, my code was working fine, but after the upgrade, there is a problem. I cannot directly assign the value of props to data in the child component during initialization.

the code was:

  @Prop()
  cropperOption!: Partial<Cropper.Options>

  defaultCropperOptions: any = {
    test: (() => {
      console.log('this.cropperOption: ', this.cropperOption)
      return 1
    })(),
    ...this.cropperOption
  }

Before the upgrade the console was: // this.cropperOption: { ratio: 1 }

After the upgrade the console is: // this.cropperOption: undefined

And I found that when I changed the target in the tsconfig.json file from esnext to es6, the console of this code returned like before the upgrade. But i dont know why, the target has always been esnext before the upgrade.

I don't know what caused this change. Does anyone know?

0 Answers0