Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Prop not being transformed properly in @Watch #22

Open
jaredmcateer opened this issue Nov 8, 2023 · 0 comments
Open

@Prop not being transformed properly in @Watch #22

jaredmcateer opened this issue Nov 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jaredmcateer
Copy link
Contributor

When a prop is being watched using a string identifier in the watch decorator the watch is not properly converting the argument to a property access of props.

      import { Component, Vue, Prop, Emit, Watch } from 'vue-property-decorator';
      @Component()
      export default class Foo {
        @Watch('b')
        handleBPropChange(newVal: number) {
          this.foo = \`\${newVal}\`;
          this.bar();
        });

        @Prop() b: number;
      }
      "import { ref } from \\"vue\\";
      const props = defineProps<{ "b": number; }>();
      const handleBPropChange = (newVal: number) => {
          foo.value = `${newVal}`;
          bar();
      };
      watch(b, handleBPropChange);
//          ^----- needs to be `props.b`
@jaredmcateer jaredmcateer added the bug Something isn't working label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant