zoukankan      html  css  js  c++  java
  • vue的computed和method的区别

    (1)computed是响应式的,methods并非响应式。
    (2)computed是带缓存的
    (3)computed中的成员可以只定义一个函数作为只读属性,也可以定义get/set变成可读写属性,这点是methods中的成员做不到的
    (4)computed是以对象的属性方式存在的,在视图层直接调用就可以得到值,例如:<div>{{msg}}</div>,而methods必须以函数形式调用,例如:<div>{{msg()}}</div>

  • 相关阅读:
    Intern Day42
    Intern Day42
    Intern Day42
    Intern Day40
    腾讯PC客户端二面
    面试
    面试
    面试
    计算机网络
    计算机网络
  • 原文地址:https://www.cnblogs.com/lmxxlm-123/p/8881341.html
Copyright © 2011-2022 走看看