Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
Vue fetch and put in data

I am new to vue js. I am making shopping web app.

Frontend request product list to backend server when product page created() and It will be write to data.

This is my data()

  name: "Product",
  data () {
    return {
      products : []
    }
  }

and This is fetch() code

 fetch('http://test.exper.cc:3001/api/v1/'+ tag +'/@public/products',
        {"method":"GET"})
        .then(
            function(response) {

              response.json().then(function (obj) {
                   this.products = obj.data
                  }

              );

Backend server returns

[{"id": 1,"name": "상품명", "desc": "상품명 이라는 상품입니다.","image": "https://image.com/image2.png", "subproducts": [{"name": "1일", "prices": {"DEFAULT": 1000}, "desc": "해당 상품은 1일 상품 입니다.", "stock_count": 10}, {"name": "7일", "prices": {"DEFAULT": 6000}, "desc": "해당 상품은 7일 상품 입니다.", "stock_count": 12}]}, {"id": 2,"name": "상품명2", "desc": "상품명2 이라는 상품입니다.", "image": "https://image.com/image.png", "subproducts": [{"name": "1일", "prices": {"DEFAULT": 1000}, "desc": "해당 상품은 1일 상품 입니다.", "stock_count": 1}, {"name": "7일", "prices": {"DEFAULT": 6000}, "desc": "해당 상품은 7일 상품 입니다.", "stock_count": 294}, {"name": "30일", "prices": {"DEFAULT": 25000}, "desc": "해당 상품은 30일 상품 입니다.", "stock_count": 19}]}]

My program makes error console log

I just need to put json to this.products data. Can you help me?

I googled this issue but it don't helps me. Sorry for my bad english ;(

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda