Difference between computed properties and methods in vue

Computed properties are computed. According to the official explanation, computed properties are cached based on their dependencies.

When the dependency does not change, the value of the computed property is obtained from the cache, and the last value is obtained

When the executed code is very long, if the result itself will not change, you can use computed properties. Of course, if you want to re-execute the code, you can use methods (methods)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324695727&siteId=291194637