0
<p v-for="(product_value, product_key, product_index) in item.product">
    {{product_key}} :{{product_value}}
    <div v-for="(item_a,index_a) in product_value" :key="index_a">
        ss{{item_a}}
    </div>
</p>

data show in view

abc :[ { "Colorx": "1"... } ]
ao_so_mi :[ { "ColorBlue": "1" .... }, { "ColorRed": "1", .... } ]

database value

{"abc":[{"Colorx":"1" ... }],"ao_so_mi":[{"ColorBlue":"1" .... },{"ColorRed":"1", ... }
return data 
this.$set(this,'items',response.data.product.data);
    for (var i = 0; i < this.items.length; i++) {
        this.items[i].product = JSON.parse(this.items[i].product);
i wanna show same : 
+item #abc : 
- Colorx : qty 1
+item #ao_so_mi : 
- ClolorBlu: qty 1
- ColorRed: qty 1

it took up quite a bit of my time, thanks for any help

2
  • What is your question? Commented Apr 13, 2022 at 6:54
  • i mean how to for array in vuejs or any idea change product_value to json, product_value return array and i can't for loop that Commented Apr 13, 2022 at 7:07

1 Answer 1

1

If I understood you correctly , you can loop again for objects keys/values:

new Vue({
  el: "#demo",
  data() {
    return {
      item: {product :{"abc":[{"Colorx":"1"  }],"ao_so_mi":[{"ColorBlue":"1" },{"ColorRed":"1" }]}}
    }
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <div v-for="(product_value, product_key, product_index) in item.product">
    +item #{{ product_key }} :
    <div v-for="(item_a, index_a) in product_value" :key="index_a">
      <div v-for="(value, key) in item_a" :key="key">
        - {{ key }}: qty {{ value }}
      </div>
    </div>
  </div>
</div>

Sign up to request clarification or add additional context in comments.

3 Comments

it's not a matter of style display position,. i can't for loop product_value to get properties
@Phương Phạm hey mate, please take a look again I updated my answer.
sorry for the late response, i just tested it, why when i use tag p it doesnt work, sounds weird, i just learn vuejs recently

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.