DEV Community 👩‍💻👨‍💻

Discussion on: Be prepared to migrate your Vue app to Vue 3

Collapse
 
wormss profile image
WORMSS

Wow, the example given looks really weird with watchers being external. We use vue-property-decorator which would do things like

import { Component, Ref, Watcher, Vue } from 'vue-property-decorator';
import NestedComponent from './NestedComponent';
@Component({ components: { NestedComponent }})
export default class MyClass extends Vue {
  @Ref()
  private someRef?: HTMLInputElement;
  private someData: string;
  private someComputed(): string { return window.localStorage.getItem('foobar') ?? '' }
  @Watcher('someData', { immediate: true })
  private onSomeDataChanged(newValue: string, oldValue?: string) {
    if(this.someRef) { this.someRef.focus(); }
  }
}

Just hope there are no super significant changes. We have over 925 *.vue files, all of them using vue-property-decorator

Thread Thread
 
chenxeed profile image
Albert Mulia Shintra Author

Yeah it'll be a hassle to migrate each of your vue files. Hopefully they don't deprecate the common interfaces in the new version for Vue 3.