Answer the question
In order to leave comments, you need to log in
How to redraw one component?
I use vue-router (I just started learning, I understand what's what).
<div id="app">
<header_v :authdata="{{ json_encode($url_data) }}"></header_v>
<router-view></router-view>
</div>
import axios from 'axios';
export default {
props: [
'authdata'
],
data: function () {
return {
login: this.authdata,
email: '',
password: ''
}
},
mounted() {
},
watch: {},
methods: {
exit: function () {
let t = this;
axios.post('/api/exit', {
_token: $('meta[name="csrf-token"]').attr('content')
}).then(response => {
t.login = null;
window.location = '/';
})
},
loginB: function () {
let t = this;
axios.post('/api/login', {
email: this.email,
password: this.password,
}).then(response => {
t.login = response.data;
$("#authmodal").modal('hide');
t.$router.go();
})
},
}
}
Answer the question
In order to leave comments, you need to log in
What does redraw mean? You set the conditions for an authorized and unauthorized user inside and they will work themselves. For example:
<header>
<div v-if="user">Здравствуйте, {{ user.name }}</div>
<button v-else>Войти</button>
</header>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question