Answer the question
In order to leave comments, you need to log in
How to toggle modal window?
I have a standard Vue.js modal window, I need to switch the login component to register when the Sign Up button is clicked
How can I do this?
Vue.component('login', {
template: `#login-template`,
data() {
return {
loginInput: '',
passwordInput: ''
}
},
methods: {
sendRequest(e) {
var self = this;
axios.post('/', {
name: this.loginInput,
password: this.passwordInput
})
.then(function (res) {
/*if (response == "ok") {
window.location.replace("/")
}*/
if (res.data.auth == true) {
self.$emit('close', res.data);
}
else {
return;
}
})
.catch(function (error) {
console.log(error);
});
},
signUpModal() {
}
}
});
<div class="login-footer">
<slot name="footer">
<div class="change-mode">
<button class="change-mode-reg" @click="signUpModal"">Sign up</button>
<div class="change-mode-line"></div>
</div>
</slot>
</div>
Answer the question
In order to leave comments, you need to log in
1) Via dynamic components https://ru.vuejs.org/v2/guide/components-dynamic-a...
2) Or better, via https://router.vuejs.org/ru/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question