Skip to content

Instantly share code, notes, and snippets.

@nicolidin
Created December 27, 2019 12:37
Show Gist options
  • Save nicolidin/52f1c7bca34e47b707bb2ca745968404 to your computer and use it in GitHub Desktop.
Save nicolidin/52f1c7bca34e47b707bb2ca745968404 to your computer and use it in GitHub Desktop.
trying to use static class inside template
<template>
<div class="home">
<div v-if="Thing.foo === yourData">
<!--the error message: Property or method "Thing" is not defined on the instance
but referenced during render -->
<p>tata</p>
</div>
<div v-else>
<p>toto</p>
</div>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
class Thing {
static foo: number = 1;
}
@Component
export default class Home extends Vue {
yourData: number = 1;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment