minixs/entity.js:混入代码
//混入的实体类
import { reactive } from 'vue';
const userEntityMixin = {
    setup() {
        const Admin = reactive({
            id: -1,
            account: "",
            userPassword: "",
        });
        const Teacher = reactive({
            id: -1,
            account: "",
            userPassword: "",
            remark: ""
        });
        const Student = reactive({
            id: -1,
            account: "",
            userPassword: "",
            remark: ""
        });
        return {
            Admin,
            Teacher,
            Student
        };
    }
};
export default userEntityMixin;
使用的代码:
import userEntityMixin from "@/ mixins/entity/index"
const {Admin, Teacher, Student} = userEntityMixin.setup();
//登录按钮事件
const login = () => {
  console.log(Admin);
  console.log(Teacher);
  console.log(Student);
}



















