Hi,
i bought the ultima template and have problems with typscript.
Following error appears:
TypeError: this.$primevue is undefined
I read that it happens if you dont include this import:
`import PrimeVue from "primevue/config";`
But I did.
What could be the Problem?
thanks
Problem using typescript
-
- Posts: 560
- Joined: 23 Oct 2020, 09:28
Hi,
You need to add
because it's a necessity for the core configuration.
Thanks,
You need to add
Code: Select all
import PrimeVue from "primevue/config";
because it's a necessity for the core configuration.
Thanks,
I also should mention that I use vue-class-component to build my components.
example:
same error for $appState and $primevue
example:
Code: Select all
<template>
...
</template>
<script lang="ts">
import { Vue, Prop } from "vue-property-decorator";
export default class AppFooter extends Vue {
@Prop({ default: "light" })
layoutMode!: string;
get isRTL(): boolean {
//return this.$appState.RTL;
return false;
}
}
</script>
<style scoped></style>
I found a solution for this.
anyone having the same problem could add:
Better would be if the primevue team add this to primevue/config/PrimeVue.d.ts:
anyone having the same problem could add:
Code: Select all
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$primevue: ReturnType<typeof usePrimeVue>,
}
};
Code: Select all
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$primevue: { config: PrimeVueConfiguration },
}
};
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests