首页 > 其他 > 详细

vue学习笔记19 computed

时间:2020-05-04 18:57:52      阅读:37      评论:0      收藏:0      [点我收藏+]

computed 的作用主要是对原数据进行改造输出

比如:拼接字符串   ¥100元

data:{

  price:100,

  news:newList

},

computed:{

  newPrice:function(){

    return this.price="¥"+this.price+“元”

  }

}

 

比如对数组进行反转 reverse

computed:{

  reverseNew:function(){

    return this.news.reverse()

  }

}

 

注意在 v-for时   item in reverseNew

vue学习笔记19 computed

原文:https://www.cnblogs.com/laohange/p/12827567.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!