Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!