Skip to content

mixins() helper issue. Computed methods are lost during inheritance #467

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

Closed
igorprodev1 opened this issue Oct 6, 2020 · 1 comment · Fixed by asvae/vue-book#66
Closed
Labels

Comments

@igorprodev1
Copy link

igorprodev1 commented Oct 6, 2020

github repository https://github.com/igorprodev1/vue-class-component-v8-issues

<script lang="ts">
import { Options, Vue, mixins } from "vue-class-component";

@Options({
  computed: {
    m1Computed(){
      return 'm1computed call'
    }
  }
})
class M1 extends Vue {}

@Options({
  computed: {
    m11Computed(){
      return 'm11computed call'
    }
  }
})
class M11 extends mixins(M1) {}

@Options({
  computed: {
    m2Computed(){
      return 'm2computed call'
    }
  }
})
class M2 extends mixins(M11) {}

export default class App extends mixins(M2) {
  get appComputed() {
    return 'app computed'
  }

  mounted () {
    console.log( (this as any).m1Computed)
    console.log( (this as any).m11Computed)
    console.log( (this as any).m2Computed)
    console.log( (this as any).appComputed)
    console.log(this)
  }
}
</script>

Console log:
m1computed call
undefined
undefined
app computed
Proxy {…}

@igorprodev1
Copy link
Author

It's working! Thank you very much!

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

Successfully merging a pull request may close this issue.

2 participants