Answer the question
In order to leave comments, you need to log in
How to add a non-global mixin to nuxt?
Create a mixin
export default {
computed: {
last: function () {
return [ ...this.items ].reverse().slice(0, 5)
},
old: function () {
return [ ...this.items ].reverse().slice(5)
}
},
data: function () {
return {
items: [
{
id: 18,
},
{
id: 17,
},
{
id: 1,
},
...
import awardsMixin from '@/plugins/mixins/non-global/items';
export default {
name: "AwardsSection",
mixin: [awardsMixin],
mounted() {
console.log(this.last)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question