<popover ref="popover">
<ul v-for="item in items">
<li @click="onClickOption(item)">Item 1</item>
...
</ul>
</popover>
methods: {
onClickOption(option) {
// какие то действия
this.$refs.popover.close();
}
}
// router.js
import store from './store';
router.beforeEach((to, from, next) => {
if (!store.getters.token) {
next({ path: '/login' });
} else {
next();
}
});
// store
const state = {
token: localStorage.getItem('token'),
};
const getters = {
token(state) {
return state.token;
},
};
const str = JSON.stringify(this.postBody);
axios.post('http://localhost:8081/', str)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
});
this.$store.dispatch('showNotification', { type: 'Success', message: 'Item was renamed!' });