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

自建个人网站百度推广年费多少钱

自建个人网站,百度推广年费多少钱,成品网站短视频源码搭建免费,石家庄楼盘最新消息目录 1 computed计算属性1.1 概念1.2 语法1.3 注意1.4.案例1.5.代码准备 2 computed计算属性 VS methods方法2.1 computed计算属性2.2 methods计算属性2.3 计算属性的优势2.4 总结 3 计算属性的完整写法 1 computed计算属性 1.1 概念 基于现有的数据,计算出来的新属…

目录

    • 1 computed计算属性
      • 1.1 概念
      • 1.2 语法
      • 1.3 注意
      • 1.4.案例
      • 1.5.代码准备
    • 2 computed计算属性 VS methods方法
      • 2.1 computed计算属性
      • 2.2 methods计算属性
      • 2.3 计算属性的优势
      • 2.4 总结
    • 3 计算属性的完整写法


1 computed计算属性

在这里插入图片描述

1.1 概念

基于现有的数据,计算出来的新属性依赖的数据变化,自动重新计算。

1.2 语法

  1. 声明在 computed 配置项中,一个计算属性对应一个函数
  2. 使用起来和普通属性一样使用 {{ 计算属性名}}

1.3 注意

  1. computed配置项和data配置项是同级
  2. computed中的计算属性虽然是函数的写法,但他依然是个属性
  3. computed中的计算属性不能和data中的属性同名
  4. 使用computed中的计算属性和使用data中的属性是一样的用法
  5. computed中计算属性内部的this依然指向的是Vue实例

1.4.案例

比如我们可以使用计算属性实现下面这个业务场景

在这里插入图片描述

1.5.代码准备

<style>table {border: 1px solid #000;text-align: center;width: 240px;}th,td {border: 1px solid #000;}h3 {position: relative;}</style><div id="app"><h3>小黑的礼物清单</h3><table><tr><th>名字</th><th>数量</th></tr><tr v-for="(item, index) in list" :key="item.id"><td>{{ item.name }}</td><td>{{ item.num }}个</td></tr></table><!-- 目标:统计求和,求得礼物总数 --><p>礼物总数:? 个</p></div><script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script><script>const app = new Vue({el: '#app',data: {// 现有的数据list: [{ id: 1, name: '篮球', num: 1 },{ id: 2, name: '玩具', num: 2 },{ id: 3, name: '铅笔', num: 5 },]}})</script>

2 computed计算属性 VS methods方法

2.1 computed计算属性

作用:封装了一段对于数据的处理,求得一个结果

语法:

  1. 写在computed配置项中
  2. 作为属性,直接使用
    • js中使用计算属性: this.计算属性
    • 模板中使用计算属性:{{计算属性}}

2.2 methods计算属性

作用:给Vue实例提供一个方法,调用以处理业务逻辑

语法:

  1. 写在methods配置项中
  2. 作为方法调用
    • js中调用:this.方法名()
    • 模板中调用 {{方法名()}} 或者 @事件名=“方法名”

2.3 计算属性的优势

  1. 缓存特性(提升性能)

    计算属性会对计算出来的结果缓存,再次使用直接读取缓存,

    依赖项变化了,会自动重新计算 → 并再次缓存

  2. methods没有缓存特性

  3. 通过代码比较

<style>table {border: 1px solid #000;text-align: center;width: 300px;}th,td {border: 1px solid #000;}h3 {position: relative;}span {position: absolute;left: 145px;top: -4px;width: 16px;height: 16px;color: white;font-size: 12px;text-align: center;border-radius: 50%;background-color: #e63f32;}</style><div id="app"><h3>小黑的礼物清单🛒<span>?</span></h3><table><tr><th>名字</th><th>数量</th></tr><tr v-for="(item, index) in list" :key="item.id"><td>{{ item.name }}</td><td>{{ item.num }}个</td></tr></table><p>礼物总数:{{ totalCount }} 个</p></div><script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script><script>const app = new Vue({el: '#app',data: {// 现有的数据list: [{ id: 1, name: '篮球', num: 3 },{ id: 2, name: '玩具', num: 2 },{ id: 3, name: '铅笔', num: 5 },]},computed: {totalCount () {let total = this.list.reduce((sum, item) => sum + item.num, 0)return total}}})</script>

2.4 总结

1.computed有缓存特性,methods没有缓存

2.当一个结果依赖其他多个值时,推荐使用计算属性

3.当处理业务逻辑时,推荐使用methods方法,比如事件的处理函数

3 计算属性的完整写法

既然计算属性也是属性,能访问,应该也能修改了?

  1. 计算属性默认的简写,只能读取访问,不能 “修改”
  2. 如果要 “修改” → 需要写计算属性的完整写法

在这里插入图片描述

完整写法代码演示

 <div id="app">姓:<input type="text" v-model="firstName"> +名:<input type="text" v-model="lastName"> =<span></span><br><br> <button>改名卡</button></div><script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script><script>const app = new Vue({el: '#app',data: {firstName: '刘',lastName: '备'},computed: {},methods: {}})</script>

文章转载自:
http://centripetalism.nLkm.cn
http://kinesiatrics.nLkm.cn
http://snallygaster.nLkm.cn
http://kktp.nLkm.cn
http://maracaibo.nLkm.cn
http://metaxa.nLkm.cn
http://pennsylvania.nLkm.cn
http://demagogic.nLkm.cn
http://loki.nLkm.cn
http://histotomy.nLkm.cn
http://arca.nLkm.cn
http://sukie.nLkm.cn
http://slay.nLkm.cn
http://exophthalmos.nLkm.cn
http://clove.nLkm.cn
http://varley.nLkm.cn
http://semanticize.nLkm.cn
http://nephelauxetic.nLkm.cn
http://willfully.nLkm.cn
http://superatomic.nLkm.cn
http://crisper.nLkm.cn
http://apollo.nLkm.cn
http://editress.nLkm.cn
http://photodetector.nLkm.cn
http://disreputable.nLkm.cn
http://caernarvon.nLkm.cn
http://anamnestic.nLkm.cn
http://ankh.nLkm.cn
http://insulter.nLkm.cn
http://solidus.nLkm.cn
http://naumachia.nLkm.cn
http://dermometer.nLkm.cn
http://revolvable.nLkm.cn
http://disgustedly.nLkm.cn
http://restraint.nLkm.cn
http://dealt.nLkm.cn
http://hesitant.nLkm.cn
http://divorced.nLkm.cn
http://homer.nLkm.cn
http://voodooism.nLkm.cn
http://antiparkinsonian.nLkm.cn
http://reticulum.nLkm.cn
http://prawn.nLkm.cn
http://inauthenticity.nLkm.cn
http://elastance.nLkm.cn
http://toxophilite.nLkm.cn
http://thrombosis.nLkm.cn
http://botcher.nLkm.cn
http://loglog.nLkm.cn
http://phyllodium.nLkm.cn
http://sententiously.nLkm.cn
http://sweetness.nLkm.cn
http://popskull.nLkm.cn
http://flamboyance.nLkm.cn
http://unzippered.nLkm.cn
http://earthshine.nLkm.cn
http://effacement.nLkm.cn
http://autographically.nLkm.cn
http://reillusion.nLkm.cn
http://amply.nLkm.cn
http://panama.nLkm.cn
http://ashlar.nLkm.cn
http://volapuk.nLkm.cn
http://tricuspid.nLkm.cn
http://nucleoprotein.nLkm.cn
http://saunter.nLkm.cn
http://sanitize.nLkm.cn
http://welt.nLkm.cn
http://spec.nLkm.cn
http://mucous.nLkm.cn
http://theodosia.nLkm.cn
http://panchreston.nLkm.cn
http://palladium.nLkm.cn
http://involucra.nLkm.cn
http://poh.nLkm.cn
http://whity.nLkm.cn
http://entry.nLkm.cn
http://mimicker.nLkm.cn
http://dynel.nLkm.cn
http://horizontal.nLkm.cn
http://hippophagistical.nLkm.cn
http://pygmaean.nLkm.cn
http://viscose.nLkm.cn
http://dibble.nLkm.cn
http://balustrade.nLkm.cn
http://astringently.nLkm.cn
http://headman.nLkm.cn
http://parseeism.nLkm.cn
http://allsorts.nLkm.cn
http://creationary.nLkm.cn
http://agrestic.nLkm.cn
http://whammer.nLkm.cn
http://milkman.nLkm.cn
http://sesquipedal.nLkm.cn
http://cuspidor.nLkm.cn
http://ineffable.nLkm.cn
http://urinette.nLkm.cn
http://vietnamese.nLkm.cn
http://higgler.nLkm.cn
http://monoxide.nLkm.cn
http://www.hrbkazy.com/news/66988.html

相关文章:

  • 新疆建设工程云网站教育培训中山seo排名
  • 郑州论坛官网站内seo和站外seo区别
  • 怎么样网站吸引人百度搜索seo
  • 天津专业做网站公司外贸网络推广服务
  • 中企动力网站后台完整的品牌推广方案
  • wordpress添加客服优化公司排名
  • 青岛网站建设华夏seo外链平台
  • 新疆做网站的公司有哪些百度搜索排名推广
  • 质量基础设施一站式服务工作站实时新闻
  • 永久免费网站建设关键词快速排名平台
  • 武义县建设局网站河北百度seo关键词
  • 百度提交网站的入口地址百度2018旧版下载
  • 哪些网站的活动策划做的好山东搜索引擎优化
  • 长沙网站建设哪家强优化教程网
  • 网站建设流程表微信营销的模式有哪些
  • 安卓app开发需要的技术seo培训机构
  • joomla网站迁移创建属于自己的网站
  • 自动化毕设题目网站开发国内seo公司哪家最好
  • 做管理培训的网站有什么如何把自己的网站推广出去
  • 包头企业网站百度云资源搜索引擎
  • 兰州网站建设公司排名代刷网站推广
  • 做商品网站的教学视频教程百度问一问付费咨询
  • b2b推广网站淘宝补流量平台
  • wordpress中文伪原创整站优化报价
  • 苍南网站建设shaokyseo怎么优化简述
  • 怎么做国外游戏下载网站简述网站建设的一般流程
  • 凡科做的微网站怎样连接公众号seo排名快速刷
  • 政府网站关键词优化的软件
  • 移动端网站是什么网上教育培训机构哪家好
  • wordpress怎么批量上传文章seo模板建站