encountered a problem when writing js. The return value obtained by $post is set to data.menu
, which is an array
with variables a
and b
,
var i
for (i = 0; i < data.menu.length; iPP) {
this.a[i] = data.menu[i]
}
this.b = data.menu
(this is what I wrote in the .vue file. a
and b
are both empty arrays defined in data
, so use this.
)
results the results are different and different in use, only b can be used normally (as a variable in component)
when comparing, if you use if (a [0] .data1 = b
if (a [0] = b [0])
and other ways to compare array elements or internal values, the result is true
,
but a direct comparison if (a = b)
is false
, I don"t know why