创建 mixin文件
const baseMixin = {
data() {},
methods: {
btnClick() {
('点击事件触发');
},
},
};
export default baseMixin;
在入口文件 中引入
import mixin from "./mixins/";
(mixin)
页面中使用
<template>
<div>
</div>
</template>
<script>
import { onMounted,onUnmounted, getCurrentInstance, ref,reactive,toRefs } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';
export default {
components: {
},
setup() {
let store = useStore();
let route = useRouter();
let state = reactive({
})
const { proxy } = getCurrentInstance();
onMounted(()=>{
()
})
onUnmounted(()=>{
})
return {
...toRefs(state)
}
}
};
</script>
<style scoped lang="less">
</style>