Getting env data in vue component

Getting env data in vue component


Getting env data inside components is easy task to do, if you want to learn how? follow simple steps below and you'll be able to have your env data inside your components.

Step 1:

Add new value in your env file and mark it with MIX like follow


Step 2:

Call for env data in component. 

data() {
  return {
    app_name: process.env.MIX_APP_NAME,
    site_domain: process.env.MIX_APP_DOMAIN,

 process + env + your variable

Step 3:

Print values in template

// OR
{{ app_name }}

// OR
{{ site_domain }}

Easy right? innocent

- Last updated 2 years ago

Be the first to leave a comment.

You must login to leave a comment