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

在组件上使用decorator装饰器报错 #9301

Closed
NextBoy opened this Issue Jan 10, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@NextBoy
Copy link

NextBoy commented Jan 10, 2019

Version

2.5.17

Reproduction link

https://codesandbox.io/s/8zyy211ky0

Steps to reproduce

the code

export const withLogin = function (Component): any {
  return class ComponentWithLogin extends Component {
  }
}
<template>
  <div>123{{ login }}</div>
</template>
<script>
  import Vue from 'vue'
  import { withLogin } from '../decorator'
  @withLogin
  class Hello extends Vue {
    login = false
  }
</script>

What is expected?

no error

What is actually happening?

But it went wrong

vue-router.esm.js?8c4f:1897 TypeError: Cannot set property 'render' of undefined
    at normalizeComponent (componentNormalizer.js?2877:24)
    at eval (hello.vue?0739:8)
    at Module../src/views/hello.vue (1.js:59)
    at __webpack_require__ (app.js:767)
    at fn (app.js:130)
@posva

This comment has been minimized.

Copy link
Member

posva commented Jan 10, 2019

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server, gitter or StackOverflow.

Not sure what you are trying to do by extending Vue class but you should check https://github.com/vuejs/vue-class-component

@posva posva closed this Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment