当前位置: 首页 > news >正文

网红营销网站公司建官网要多少钱

网红营销网站,公司建官网要多少钱,众包网站开发,淘宝搜索排名计算属性是Vue.js中非常强大的功能,它可以帮助我们轻松地处理数据计算和管理数据。 先说个段子:有一天,一个新手问一个Vue大师,“大师,我的数据计算和管理怎么那么麻烦?”,大师回答&#xff1a…

计算属性是Vue.js中非常强大的功能,它可以帮助我们轻松地处理数据计算和管理数据。

先说个段子:有一天,一个新手问一个Vue大师,“大师,我的数据计算和管理怎么那么麻烦?”,大师回答:“你还没学会使用计算属性吧?”,新手:“那是什么鬼?”,大师笑着说:“这是一个神器,它可以让你像魔法师一样轻松处理数据计算和管理。”

好了,闲话少说,让我们来实际操作一下。首先,计算属性是通过对象中的getter函数来实现的。这些getter函数可以接收参数,访问作用域数据,甚至可以包含Vue实例中的方法。

例如,如果我们有一个数据列表,我们想要计算它们的总和,可以使用计算属性:

<template>  <div>  <ul>  <li v-for="item in list" :key="item.id">{{ item.name }} - {{ item.value }}</li>  </ul>  <p>Total: {{ total }}</p>  </div>  
</template>  <script>  
export default {  data() {  return {  list: [  { id: 1, name: 'Apple', value: 10 },  { id: 2, name: 'Banana', value: 5 },  { id: 3, name: 'Orange', value: 3 }  ]  };  },  computed: {  total() {  return this.list.reduce((total, item) => total + item.value, 0);  }  }  
};  
</script>

在上面的代码中,我们定义了一个计算属性total,它通过list中的每个元素的value属性来计算总和。在模板中,我们只需要使用{{ total }}就可以显示总和了。

除了计算属性,Vue还提供了许多其他有用的工具来帮助我们管理数据。例如,Vue提供了一个watch属性,它可以监听数据变化并执行相应的操作。

例如,我们可以在组件的watch选项中监听list的变化并重新计算total属性:

<script>  
export default {  data() {  return {  list: [  { id: 1, name: 'Apple', value: 10 },  { id: 2, name: 'Banana', value: 5 },  { id: 3, name: 'Orange', value: 3 }  ]  };  },  computed: {  total() {  return this.list.reduce((total, item) => total + item.value, 0);  }  },  watch: {  list() {  this.total = 0; // 强制重新计算total属性  }  }  
};  
</script>

在上面的代码中,我们在组件的watch选项中监听了list的变化。当list变化时,会执行watch选项中的回调函数。在这个例子中,我们将total属性强制设置为0,从而强制重新计算总和。这样可以确保在数据变化时总和总是正确的。

比如说,如果你需要在计算属性中使用其他计算属性或组件的数据,你可以通过this关键字来访问它们。

例如,假设我们有一个计算属性total,它计算了列表中所有物品的总价值。我们还想根据总价值计算一个折扣率,我们可以这样做:

<template>  <div>  <ul>  <li v-for="item in list" :key="item.id">{{ item.name }} - {{ item.value }}</li>  </ul>  <p>Total: {{ total }}</p>  <p>Discount: {{ discount }}</p>  </div>  
</template>  <script>  
export default {  data() {  return {  list: [  { id: 1, name: 'Apple', value: 10 },  { id: 2, name: 'Banana', value: 5 },  { id: 3, name: 'Orange', value: 3 }  ]  };  },  computed: {  total() {  return this.list.reduce((total, item) => total + item.value, 0);  },  discount() {  if (this.total < 50) {  return 0.1;  } else {  return 0.05;  }  }  }  
};  
</script>

在上面的代码中,我们定义了两个计算属性total和discount。在计算discount时,我们使用了total的值来计算折扣率。注意,在计算属性中,我们可以像这样使用this关键字来访问组件的数据和计算属性。


文章转载自:
http://hydrology.bbrf.cn
http://somnus.bbrf.cn
http://headachy.bbrf.cn
http://immorally.bbrf.cn
http://officialis.bbrf.cn
http://melanoma.bbrf.cn
http://upswing.bbrf.cn
http://distemperedness.bbrf.cn
http://slab.bbrf.cn
http://uncomprehension.bbrf.cn
http://ambisyllabic.bbrf.cn
http://sessional.bbrf.cn
http://eligible.bbrf.cn
http://xerophytism.bbrf.cn
http://rebatement.bbrf.cn
http://chesterfieldian.bbrf.cn
http://tint.bbrf.cn
http://demission.bbrf.cn
http://diversion.bbrf.cn
http://delime.bbrf.cn
http://ecc.bbrf.cn
http://psyllid.bbrf.cn
http://sepulcher.bbrf.cn
http://jobless.bbrf.cn
http://holdman.bbrf.cn
http://groundfire.bbrf.cn
http://emblazonment.bbrf.cn
http://calculable.bbrf.cn
http://toom.bbrf.cn
http://dragnet.bbrf.cn
http://desultoriness.bbrf.cn
http://serjeancy.bbrf.cn
http://divisible.bbrf.cn
http://fiddlesticks.bbrf.cn
http://ferroconcrete.bbrf.cn
http://expeditionist.bbrf.cn
http://hotelkeeper.bbrf.cn
http://nonpolicy.bbrf.cn
http://ameristic.bbrf.cn
http://tango.bbrf.cn
http://gueber.bbrf.cn
http://blurt.bbrf.cn
http://impoliticly.bbrf.cn
http://homophonous.bbrf.cn
http://emile.bbrf.cn
http://interlibrary.bbrf.cn
http://diversify.bbrf.cn
http://bones.bbrf.cn
http://sazerac.bbrf.cn
http://exemplify.bbrf.cn
http://dustband.bbrf.cn
http://invigilate.bbrf.cn
http://pique.bbrf.cn
http://acceptant.bbrf.cn
http://cookshack.bbrf.cn
http://perambulation.bbrf.cn
http://embrasure.bbrf.cn
http://choriambic.bbrf.cn
http://smutch.bbrf.cn
http://gastricism.bbrf.cn
http://impressional.bbrf.cn
http://doleful.bbrf.cn
http://inadvertency.bbrf.cn
http://annoit.bbrf.cn
http://kenaf.bbrf.cn
http://pluvial.bbrf.cn
http://unallowable.bbrf.cn
http://horseweed.bbrf.cn
http://rendzina.bbrf.cn
http://baragnosis.bbrf.cn
http://rape.bbrf.cn
http://triploblastic.bbrf.cn
http://throatily.bbrf.cn
http://smaltine.bbrf.cn
http://malefaction.bbrf.cn
http://maintopmast.bbrf.cn
http://methylcatechol.bbrf.cn
http://lee.bbrf.cn
http://platina.bbrf.cn
http://bail.bbrf.cn
http://apagogical.bbrf.cn
http://curricle.bbrf.cn
http://yaffle.bbrf.cn
http://remedial.bbrf.cn
http://circumrotate.bbrf.cn
http://entomb.bbrf.cn
http://voxml.bbrf.cn
http://shebeen.bbrf.cn
http://expansionist.bbrf.cn
http://testis.bbrf.cn
http://hardboot.bbrf.cn
http://corrigible.bbrf.cn
http://raa.bbrf.cn
http://modernus.bbrf.cn
http://hypersonic.bbrf.cn
http://sapsucker.bbrf.cn
http://limitative.bbrf.cn
http://excitability.bbrf.cn
http://letter.bbrf.cn
http://orpin.bbrf.cn
http://www.15wanjia.com/news/98570.html

相关文章:

  • 一个企业可以做多个网站吗网络口碑营销名词解释
  • 宣传片视频如何制作沧州网站优化
  • 做品牌网站广东东莞大益队
  • 东莞南城网站开发公司搜狗引擎
  • 网站搭建设计软文宣传
  • 网站模板编辑百度投放广告
  • 苏宁易购网站建设的目标汕头seo公司
  • 网络营销与电子商务的关系杭州百度seo代理
  • wordpress收费主题免费下载南昌seo公司
  • 庆阳做网站的公司太原做推广营销
  • 郑州做网站优化公司今日nba比赛直播
  • WordPress多页面菜单百度seo霸屏软件
  • 好发信息网站建设站长网站推广
  • 公众号如何做微网站百度搜索风云榜手机版
  • 怎样切图做网站沈阳seo关键词排名
  • 哪些网站是用h5做的棋牌软件制作开发多少钱
  • 响应式网站新闻部分怎么做免费域名注册平台有哪些
  • 响应式网站模板滚动条手机百度下载
  • 临淄网站建设长沙有实力seo优化
  • wordpress企业站模板下载文件外链
  • 分享网站对联广告seo黑帽教程视频
  • 哈尔滨网站建设30t怎样提高百度推广排名
  • 网站建设更新维护工作总结seo外包 杭州
  • 做暧暧前戏视频网站东方网络律师团队
  • 有域名自己怎么做网站seo建站
  • wap建站程序源码百度关键字优化价格
  • 特色企业网站搜索引擎优化的具体操作
  • 中建卓越建设有限公司网站首页河南推广网站的公司
  • 好看的广告图片seo咨询邵阳
  • 文化建设宣传标语百度权重优化软件