Using Environment Variables with Vue.js

Vue.js with Webpack If you use vue cli with the Webpack template (default config), you can create and add your environment variables to a .env file. The variables will automatically be accessible under process.env.variableName in your project. Loaded variables are also available to all vue-cli-service commands, plugins and dependencies. You have a few options, this … Read more

Default values for Vue component props & how to check if a user did not set the prop?

Vue allows for you to specify a default prop value and type directly, by making props an object (see: https://vuejs.org/guide/components.html#Prop-Validation): props: { year: { default: 2016, type: Number } } If the wrong type is passed then it throws an error and logs it in the console, here’s the fiddle: https://jsfiddle.net/cexbqe2q/

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

How to set URL query params in Vue with Vue-Router

Here is the example in docs: // with query, resulting in /register?plan=private router.push({ path: ‘register’, query: { plan: ‘private’ }}) Ref: https://router.vuejs.org/en/essentials/navigation.html As mentioned in those docs, router.replace works like router.push So, you seem to have it right in your sample code in question. But I think you may need to include either name or … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)