Questions tagged [vue-class-components]
132 questions
18
votes
2 answers
Vue 3 Typescript Class Component - Type 'typeof import(.../node_modules/vue/dist/vue")' is not a constructor function type
Hi I'm using Vue 3 with Typescript and Class Components. I just copy-pasted the example from the docs but it looks like there is an issue with Typescript:
TS1238: Unable to resolve signature of class decorator when called as an expression.
This…

Tom
- 1,358
- 2
- 14
- 36
18
votes
2 answers
what will happen for vuejs projects based on class components in vuejs v3.0?
I wanna upgrade my vuejs project to typescript based on class components, but i read in vue issue's https://github.com/vuejs/rfcs/pull/17#issuecomment-494242121 :
Update: the Class API proposal is being dropped.
so what will happen to existing…

SeyyedKhandon
- 5,197
- 8
- 37
- 68
10
votes
1 answer
Property does not exist on the type in vue-class-component
I got an error in my TypeScript component file that a prop doesn't exist, but I declared the prop exactly as described in the vue-class-component documentation example.
Property 'propMessage' does not exist on type 'MyComponent'.Vetur(2339)
How do…

Jon Sud
- 10,211
- 17
- 76
- 174
9
votes
2 answers
How to setup Webpack so that will be able to use Pug in both Single File Components (.vue) and "vue-class-component" classes?
According Vue.js documentatin to use pug pre-processor in Single File Components, pug-plain-loader (not pug-loader) required:
{
test: /\.pug$/,
loader: 'pug-plain-loader'
}
What if besides Singe File Components (.vue files) I also need to…

Takeshi Tokugawa YD
- 670
- 5
- 40
- 124
9
votes
0 answers
How to build a es6 vue-component library using vue-class-component
I am trying to create a vuejs component library in typescript with vue-class-component and vue-property-decorator with the following requirements:
The library components should be written in class-style typescript.
The library components should be…

ShabbY
- 896
- 5
- 9
8
votes
1 answer
What access modifiers should I use for the class-component in Vue?
I'm wondering what modifiers should I use for properties and methods in Vue classes? (I use vue-class-component package). public, private, protected?
Or should I turn off the linter rule that says I need to set an access modifier?
Here is an…

Илья Зеленько
- 7,509
- 3
- 44
- 55
8
votes
1 answer
vue-class-component: Super expression must either be null or a function, not undefined
Ok, it's a weird usecase, but in any case.
I have a controls component, that includes menu component, that also includes a controls component but without menu (strange stuff, but that's design).
What I do.
Controls component:
import {Component,…

Terion
- 2,396
- 3
- 28
- 42
7
votes
1 answer
Reactive Vue Chart.js component using Typescript
Using vue-property-decorator (or actually its Component and Prop of vue-class-component) and vue-chartjs-typescript, I am trying to make a BarChart-component with the properties chartData and options. The following code actually works when serving…

Neman
- 1,237
- 2
- 13
- 16
7
votes
2 answers
vue-class-component : how to create and initialize reflective data
I'm using vuejs with typescript and vue-class-component. I'm trying to create a custom component with reactive data.
Here is my code:

jaudo
- 2,022
- 4
- 28
- 48
7
votes
2 answers
vue access imported variable in template
Is there some way to use an imported object in the template without specifying an alias/property for it in the vue component. I.e. can I somehow use variables not defined on "this"
//Store not…

Chris
- 13,100
- 23
- 79
- 162
6
votes
4 answers
(How) Should I use access modifiers (public, private etc.) in Vue.js components (TypeScript)?
I have a Vue.js v2.6 project with TypeScript v.4.3 "under the hood".
My problem: I cannot find any documentation that clears up, if it makes sense to use access modifiers in Vue components and how to use them correctly.
I searched through articles,…

jasie
- 2,192
- 10
- 39
- 54
6
votes
1 answer
Vue 3 using v-model as props instead of :prop and @emit
So I've read this article a couple of times and as I understand, I can use v-model, instead of props, to pass values from a parent to a child component and automatically emit event when prop's value is modified in a child, thus getting two-way…

Igor Nikiforov
- 611
- 1
- 7
- 17
6
votes
1 answer
Vuelidate with Vue 3 + vue-class-component + TypeScript
Does anyone know any working example with the mentioned stack? I know Vuelidate is still alpha when it comes to Vue 3, but my guess is if it works with Composition API, then there should be a workaround to make it work with classes.
I'm trying the…

Igor Nikiforov
- 611
- 1
- 7
- 17
6
votes
1 answer
How to access an HTML ref in VueJS 3 and Typescript with Vue Class Component?
I'm banging my head on the following problem: I created a QRCode component using Vue 3 and Typescript with the following code: