ミックスインの使用
ミックスインは通常、複数のコンポーネントに同じコードのパーツが含まれている場合に使用され、共通のパーツはミックスインミキサーに書き込まれてから、異なるコンポーネントにミックスされます。
export const mixin={
methods:{
add(){
this.qqq++;
}
}
}
<template>
<div>
<button @click="add">+</button>
{
{qqq}}
</div>
</template>
<script>
import {mixin} from "@/mixin";
export default {
name: "cpna",
mixins:[mixin],
data(){
return {
qqq:0,
}
}
}
</script>
<style scoped>
</style>