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

fix: Identifier in computed OptionalMemberExpression #26

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

lsdsjy
Copy link
Contributor

@lsdsjy lsdsjy commented Dec 1, 2021

This case should be consistent with the MemberExpression case, where Identifiers in computed OptionalMemberExpression Property should be prepended with "vm".

@JuniorTour JuniorTour merged commit f53d618 into JuniorTour:main Dec 1, 2021
@JuniorTour
Copy link
Owner

JuniorTour commented Dec 1, 2021

Thanks for your contribution!

Do you have interest to add a test case for this PR?

You can refer to these commit and make another PR:

@lsdsjy
Copy link
Contributor Author

lsdsjy commented Dec 1, 2021

Yeah sure. See #27
Don't know if the test case description is clear enough though.

@xiaoxiangmoe
Copy link

@lsdsjy also we need support foo?.bar.c ?? d?.(e)?.[f].

@JuniorTour
Copy link
Owner

@lsdsjy also we need support foo?.bar.c ?? d?.(e)?.[f].

@xiaoxiangmoe Thank you for your feedback, I just tried the code below:

<template>
  <div id="app">
    <h1>2021年12月02日11:05:55</h1>
    <h2>{{obj?.prop.nullish ?? optional?.(chainingKey)?.[chainingKey]}}</h2>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      optional: function (key) {
          console.log(key)  // 'chainingKey'
          return {
            chainingKey: 'inner chainingKey'
          }
      },
      obj: {
        prop: {
          nullish: null,
        }
      },
      chainingKey: 'chainingKey',
    }
  }
}
</script>

It works find after this PR:
image

I will publish a new version later, try it.

If you still have any problem, open an issue or comment, just let me know.

@JuniorTour
Copy link
Owner

v1.0.7 just published after this PR.

You can try it by:

npm install vue-template-babel-compiler --save-dev
// or 
yarn add vue-template-babel-compiler --save-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants