I am new to Vue JS. I have created two different components Login and Register but with same form code I mean like email input and password input and a submit button, I got familiar with Mixins, so I created a mixin for submitting the form and I am using the same mixin in both register and login
// this is mixin
data() {
return {
email: "",
password: ""
};
},
methods: {
onSubmit() {
console.log(this.email);
},
},
How can I create a custom reusable component like this mixin , so I just want to pass props ? below is the login form and the register form is same like this I don't want to repeat
// this is Login Component
<v-form>
<v-text-field
type="email"
v-model="email"
label="E-Mail"></v-text-field>
<v-text-field
type="password"
v-model="password"
label="Password"></v-text-field>
<v-btn @click="onSubmit()" color="info">Submit</v-btn>
<script>
import CredMixin from "../mixins/Credentials";
export default {
name: "Login",
mixins: [CredMixin],
};
</script>