weex scenario requires that the parent layout pass / not pass the fields in the computed to the child layout.
weex is bound through computed. When a field is passed in the parent layout, computed triggers the set, child layout of the field to reference the field and triggers get.
the following is e.g.:
<father itemdto="{{data}}"> </father>
<child > itemdto </child >
<script
computed: {
itemdto: {
set: function(data) {
},
get: function() {
},
}
}
</script>
the value passed by the parent component triggers the set, child component to get the value to trigger the get. Data change binding is very consistent
but in vue, the parent component cannot pass itemdto, directly to the child component, only props. You cannot bind directly like weex"s computed. The computed in vue is used to calculate the incoming props, and change the value in data. But you need to call set actively. Weex does not need it. Set has already been called when itemdto is sent in.
in addition, the watch method can only be triggered after the listening data has changed. When the parent layout does not pass itemdto, the child layout cannot automatically trigger watch. Weex can trigger the get method of itemdto to get the default value.
to sum up, in the process of weex = "vue, both watch and computed using vue feel incompetent for the corresponding computed in weex.
may be because I use it improperly, and ask the boss for advice!