Detect click outside element

There is the solution I used, which is based on Linus Borg answer and works fine with vue.js 2.0. Vue.directive(‘click-outside’, { bind: function (el, binding, vnode) { el.clickOutsideEvent = function (event) { // here I check that click was outside the el and his children if (!(el == event.target || el.contains(event.target))) { // and if … Read more

What does the @ mean inside an import path?

This is done with Webpack resolve.alias configuration option and isn’t specific to Vue. In Vue Webpack template, Webpack is configured to replace @/ with src path: const path = require(‘path’); … resolve: { extensions: [‘.js’, ‘.vue’, ‘.json’], alias: { … ‘@’: path.resolve(‘src’), } }, … The alias is used as: import ‘@/<path inside src folder>’;

Vuejs Error: The client-side rendered virtual DOM tree is not matching server-rendered

Partial answer: with Chrome DevTools, you can localize the issue and see exactly what element caused the issue. Do the following (I did that with Nuxt 5.6.0 and Chrome 64.0.3282.186) Show DevTools in Chrome (F12) Load the page that causes “the client-side rendered virtual DOM tree…” warning. Scroll to the warning in DevTools console. Click … Read more

CORS error even after setting Access-Control-Allow-Origin or other Access-Control-Allow-* headers on client side

Access-Control-Allow-Origin is a response header the server the request goes to must send. And all other Access-Control-Allow-* headers are response headers for servers to send. If you don’t control the server your request is sent to, and the problem with the response is just the lack of the Access-Control-Allow-Origin header or other Access-Control-Allow-* headers you … Read more