当我按相应的按钮时,为什么greet
会返回[Vue warn]: Property or method "greet" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in <Inputs>)
?
<template id="input-template">
...
<div v-for="(inputs, inputName) in renderedSystemComponent">
<button v-on:click="greet">Greet</button>
...
</template>
Vue.component('inputs', {
template: '#input-template',
props: ['systemComponents','selectedSystemProductComponents'],
data () {
return {
renderedSystemComponent: [],
}
},
methods: {
greet: function () {
alert('Hello ');
}
},
watch: {
selectedSystemProductComponents: function() {
...
}
},
});