test
test

Reputation: 305

How to access to subfolders in vue

I have below folders

src
  -common
    -> test.js
  -views
    ->test
      -1.vue

I need to call common folder in 1.vue.

I have tried below script, but its not working.

import { common } from '../common'

Is there any suggestion on how can I call common folder from 1.vue?

Upvotes: 0

Views: 153

Answers (1)

Daniel Richter
Daniel Richter

Reputation: 358

If test.js is a default export then:

import Test from '../../common/test';

If it's a named export then:

import { Test } from '../../common/test';

Upvotes: 2

Related Questions