I am faced with a situation where I have two vue component files. How can I utilize the changeCollection()
method from Check-list.vue in another Component.vue file?
Check-lust.vue:
<template lang="html" ref="">
<div class="check-list-view">
<collections :current_collection="this.current_collection" ></collections>
</div>
</template>
<script>
export default {
data () {
return {
current_collection: 'All'
}
},
methods: {
changeCollection (collname) {
this.current_collection = collname
}
}
}
</script>
And Component.vue:
<template lang="html">
<div class="container " style="margin-bottom:32px">
<!-- NOT WORKS: -->
<button type="button" name="button" class="btn my-btn-orange" @click="changeCollection('All')">All</button>
</div>
</template>
<script>
export default {
props: ['current_collection']
}
</script>