I am trying to create a vue component with vue-class-component and typescript (found here https://github.com/vuejs/vue-class-component). From what I understand, data is defined in the class, as I have done below - yet I receive the error:
"[Vue warn]: Property or method "test" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property."
Here is a stripped down version of my actual code, but it still doesn't work:
<template>
<div id="vue-test">
<input v-model="test"/>
{{test}}
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';
@Component({
})
export default class AppearanceDialogVue extends Vue {
public test: string = '100';
}
</script>
EDIT: It appears that changing 'test's declaration to
public test: string;
worked
test = '100';
withoutpublic
andstring
? – Bennett Dams