<template>
<ul class="nav flex-column nav-pills side-nav" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<li
class="list-group-item"
v-for="(menuItem, index) in menu"
:key="index"
:class="{
active: $route.path === menuItem.url
}"
>
<router-link :to="menuItem.url">
{{ menuItem.title }}
</router-link>
</li>
</ul>
</template>
export default {
data: () => ({
menu: [
{
title: 'Перспективное меню',
url: '/nutrition/foodmenu'
},
{
title: 'Журнал питания',
url: '/nutrition/journal'
},
{
title: 'Амбарная книга',
url: '/nutrition/ambarbook'
}
]
})
}
<ul class="nav flex-column nav-pills side-nav" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<li class="list-group-item" :class="{ active: $route.path === '/nutrition/foodmenu' }"> <router-link to="/nutrition/foodmenu">Перспективное меню</router-link></li>
<li class="list-group-item" :class="{ active: $route.path === '/nutrition/journal' }"><router-link to="/nutrition/journal">Журнал питания</router-link></li>
<li class="list-group-item" :class="{ active: $route.path === '/nutrition/ambarbook' }"><router-link to="/nutrition/ambarbook">Амбарная книга</router-link></li>
</ul>
const mapStateToProps = ({ user, data }) => {
const myProp = localStorage.get('myProp');
return {
myProp,
user,
data
}
};
const mapStateToProps = props => props;
// api.js
import axios from 'axios';
const API = axios.create({
baseURL: 'https://mysite.com/api',
headers: {
'Content-Type': 'application/json',
'Authorization': process.env.TOKEN,
},
withCredentials: true,
});
API.interceptors.response.use(response => {
console.log('yeeeeeeeeeeeeeeeeeeeeeeeee');
console.log(response);
return response;
}, error => {
console.log('fuuuuuuuuuuuu');
console.log(error);
return Promise.reject(error);
});
export default API
// services/cart.js
import API from 'api'
export default {
async getCart () {
const { data } = await API.get('/cart')
}
}
// services/catalog.js
import API from 'api'
export default {
async getCatalog () {
const { data } = await API.get('/catalog')
}
}
// main.js
import { getCatalog } from 'services/catalog'
import { getCart } from 'services/cart'
async (() => {
await Promise.all([
getCatalog(),
getCart()
])
})();
try {
const response = await Promise.all(map(list, ({address}) => ymaps.geocode(`address`)))
const coordinates = map(response, (coordinate) => coordinate.geoObjects.get(0).geometry.getCoordinates());
allCoordinates.push(...coordinates);
} catch (error) {
this.props.onError();
}