in my vue subscribe-button components, i have mentioned every part props computed and methods. In computed i mentioned the subscribed property: but still it's giving me an error of:-
" [Vue warn]: Property or method "subscribed" 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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. "
Subscribe-buttom.js
Vue.component('subscribe-button', {
props: {
profile: {
type: Object,
required: true,
default: () => ({})
},
subscriptions: {
type: Array,
required: true,
default: () => []
}
},
computed: {
subscribed: function() {
if (!__auth() || this.profile.user_id == __auth().id) return false
return !!this.subscriptions.find(subscription => subscription.user_id == __auth().id)
}
},
methods: {
toggleSubscription() {
if (!__auth()) {
alert('Please login to Subscribe')
}
}
}
})
This is a part of my show.blade.php.
<div class="text-center">
<subscribe-button :profile="" :subscriptions="" inline-template>
<button @click='toggleSubscription' class="btn btn-danger">
@ 7k
</button>
</subscribe-button>
</div>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire