Vue: computed has an error

Created on 7 Sep 2016  ·  4Comments  ·  Source: vuejs/vue

Vue.js version

1.0.26

Demo

jsfiddle
or
test

result

click the button then the result will has error
left is ios 9.3.4 iphone 6 plus right is android phone
result

has error

ios 9.3.3 and 9.3.4 iphone 6s plus or iphone 5s

no error

ios 8.2 iphone 6 ,some android phone,PC chrome

from #3545

Most helpful comment

@posva Yeah it works I just wanted to post the same example. For in breaks the app because OP doesn't use hasOwnProperty check and is looping over inherited properties which you definitely want to avoid. I recommend to start using Eslint and follow good JS practices - https://github.com/airbnb/javascript#iterators-and-generators

All 4 comments

I don't have a device to test it. Does this https://jsfiddle.net/bzyyvafg/ work?

@posva Yeah it works I just wanted to post the same example. For in breaks the app because OP doesn't use hasOwnProperty check and is looping over inherited properties which you definitely want to avoid. I recommend to start using Eslint and follow good JS practices - https://github.com/airbnb/javascript#iterators-and-generators

Then I'm closing this 🙂

it works. thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guan6 picture guan6  ·  3Comments

loki0609 picture loki0609  ·  3Comments

hiendv picture hiendv  ·  3Comments

franciscolourenco picture franciscolourenco  ·  3Comments

bdedardel picture bdedardel  ·  3Comments