vuejs / vue-class-component

ES / TypeScript decorator for class-style Vue components.
MIT License
5.81k stars 429 forks source link

vue3 Update docs e.g. @Component is show in all examples whit no reference to @Options #582

Open SergioFaya opened 2 years ago

SergioFaya commented 2 years ago

As a new Vue developer, I chose to start using vue-cli with typescript and vue-class-component. But when I started the project there was no @Component annotation on the classes but a @Options one.

After further investigating I discovered that this is a feature added for the Vue3 version but on the home page the Vue2 explanations are shown. Would be necessary to provide more comprehensive docs regarding the differences between the maintained versions like shown in here

Irozaih commented 2 years ago

Any news on v8.0 documentation?

akoidan commented 2 years ago

https://github.com/akoidan/vue3-vite-vue-class-component

As I understand vue3 is far from being supported at all. Using this example: package.json:

{
    "vue-class-component": "https://github.com/vuejs/vue-class-component#next"
}
<template>
  <div>{{ count }}</div>
  <button @click="increment">+1</button>
</template>

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

@Options({})
export default class Counter extends Vue {
  count = 0

  increment() {
    this.count++
    console.log('as')
  }

  decrement() {
    this.count--
  }
}
</script>
rm -rf node_modules && \
yarn install && \
cd node_modules/vue-class-component && \
yarn install && \
yarn build && \
cd ../.. 

property count is not reactive. Upon pressing a button it stil shows 0