M
M
MaximilianK2020-01-24 15:24:11
Vue.js
MaximilianK, 2020-01-24 15:24:11

How to get data from local js file?

there is a js file in it data in the form:

export const products = [
  {
    "name": "mobile1",
    "type": "big",
    "color": "green",
  },
  {
    "name": "mobile2",
    "type": "small",
    "color": "blue",
  }
]

how to get products in component?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2020-01-24
@MaximilianK

import {products} from './path/to/js-file';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question