javascript - Vue.js - How to render data changes in child component? -
so have parent component store has child component called order. data parent passed via props child, so:
parent
<order :order="order" />   child
props: ['order']   i need use new data variable in child component called orderids, declare that:
child
props: ['order'], data: () {   return {     orderids: object.keys(this.order)   } }   then, render orderids in view:
{{orderids}}   now, whenever order data changes in parent, updates prop order in child, not propagated through orderids.
how update orderids when changes in order?
instead of data use computed property.
computed: {     orderids: function () {       return object.keys(this.order);     }   }      
Comments
Post a Comment