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

做网站的抬头怎么做seo必备软件

做网站的抬头怎么做,seo必备软件,网站的简单布局,帮忙建设公司网站vue2 由于javascript限制&#xff0c;vue不能检测数组和对象的变化 什么意思呢&#xff0c;举例子来说吧 深入响应式原理 对象 比如说我们在data里面定义了一个info的对象 <template><div id"app"><div>姓名: {{ info.name }}</div><…

vue2

由于javascript限制,vue不能检测数组和对象的变化
什么意思呢,举例子来说吧
深入响应式原理

对象

比如说我们在data里面定义了一个info的对象

<template><div id="app"><div>姓名: {{ info.name }}</div><div>年龄: {{ info.age }}</div><div>地址: {{ info.address }}</div><button @click="handleAddProp">追加prop</button></div>
</template><script>
export default {name: "App",data() {return {info: {name: "于十月",age: 28,},};},methods: {handleAddProp() {this.info.address = "山东省济南市";},},
};
</script>

在这里插入图片描述

我们在info对象里面只定义了name,age两个字段,然后我们在页面展示了name,age,address三个字段,我们想再点击按钮的时候,给address赋值,这个时候会有什么效果?可以自己试一下,效果就是,页面上没有任何效果也就是说我们在info声明的时候没有address这个字段,后续我们在操作中去修改这个字段,vue是不能给我们检测到的
在这里插入图片描述

所以要想实现效果的话官方给提供实现方案

  • Vue.set或者this.$set
  • Object.assign()或者_.extend()

具体实现如下:

<template><div id="app"><div>姓名: {{ info.name }}</div><div>年龄: {{ info.age }}</div><div>地址: {{ info.address }}</div><div>手机号: {{ info.phone }}</div><button @click="handleAddProp">追加prop</button></div>
</template><script>
export default {name: "App",data() {return {info: {name: "于十月",age: 28,},};},methods: {handleAddProp() {// this.info.address = "山东省济南市";this.$set(this.info, "address", "山东省济南市");// orthis.info = Object.assign({}, this.info, { phone: 138888888888 });},},
};
</script>

数组

vue不能检测以下数组的变动

  • 当你利用索引直接设置一个数组项时 vm.items[index] = newValue
  • 当你修改数组的长度时 vm.items.length = newLength
<template><div id="app"><p v-for="(val, index) in list" :key="index">{{ val }}</p><button @click="handleChangeList">修改数组项</button></div>
</template><script>
export default {name: "App",data() {return {list: [1, 2, 3, 4],};},methods: {handleChangeList() {this.list[0] = "小明";},},
};
</script>

在这里插入图片描述
我们希望点击按钮的时候1能够变成小明,但发现并没有任何效果,要想实现的话也可以使用$set

<template><div id="app"><p v-for="(val, index) in list" :key="index">{{ val }}</p><button @click="handleChangeList">修改数组项</button></div>
</template><script>
export default {name: "App",data() {return {list: [1, 2, 3, 4],};},methods: {handleChangeList() {// this.list[0] = "小明";this.$set(this.list, 0, "小明");},},
};
</script>

vue3

我们可以按照上面的数据在vue里面试一下

<script setup>const info = reactive({name: '于十月',});const list = ref([1, 2, 3]);const handleAddProp = () => {info.address = '山东省济南市';info.age = 28;};const handleChangeList = () => {list.value[0] = '小明';};
</script><template><div>姓名: {{ info.name }} -- 年龄 {{ info.age }} --- {{ info.address }}</div><a-button @click="handleAddProp">修改prop</a-button><div><p v-for="(val, index) in list" :key="index">{{ val }}</p></div><a-button @click="handleChangeList">修改数组的值</a-button>
</template>

在这里插入图片描述
然后发现不需要做特殊的处理,就可以实现我们想要的效果

其实这里面就牵扯到了关于vue2与vue3内部实现响应式的原理了,vue2使用defineProperty,vue3的时候直接放弃用了proxy
具体怎么他俩怎么实现的后面在写

这就可以延伸出来很多面试题,比如
1.vue2跟vue3在处理数据这一块有什么不同吗?
2.vue2里面我往对象里面新增一个属性,这个时候界面会有变化吗?
3.为什么使用 $set之后就可以实现数据的响应, $set的实现原理是什么?
4.vue2在处理对象和数据的时候有什么弊端?
。。。。。
即使没搞明白深层原理,把官方文档看明白,碰到这些问题也会迎刃而解~


文章转载自:
http://knuckleball.cwgn.cn
http://diy.cwgn.cn
http://orchitis.cwgn.cn
http://limicoline.cwgn.cn
http://lirot.cwgn.cn
http://patronize.cwgn.cn
http://refugee.cwgn.cn
http://increscent.cwgn.cn
http://gut.cwgn.cn
http://trichomycin.cwgn.cn
http://preprocessor.cwgn.cn
http://monosaccharide.cwgn.cn
http://geraniol.cwgn.cn
http://eremophilous.cwgn.cn
http://tatterdemalion.cwgn.cn
http://thermos.cwgn.cn
http://demonstrability.cwgn.cn
http://geomedical.cwgn.cn
http://cockish.cwgn.cn
http://chukkar.cwgn.cn
http://bedeman.cwgn.cn
http://respiration.cwgn.cn
http://bookish.cwgn.cn
http://vying.cwgn.cn
http://roselite.cwgn.cn
http://auditive.cwgn.cn
http://opticist.cwgn.cn
http://labilise.cwgn.cn
http://science.cwgn.cn
http://connivent.cwgn.cn
http://laywoman.cwgn.cn
http://heroise.cwgn.cn
http://neurocirculatory.cwgn.cn
http://acgb.cwgn.cn
http://newsweekly.cwgn.cn
http://upblown.cwgn.cn
http://hanamichi.cwgn.cn
http://annuities.cwgn.cn
http://dihydric.cwgn.cn
http://gorki.cwgn.cn
http://silicic.cwgn.cn
http://exultantly.cwgn.cn
http://woodchuck.cwgn.cn
http://restore.cwgn.cn
http://tobruk.cwgn.cn
http://suffumigate.cwgn.cn
http://nominalize.cwgn.cn
http://indite.cwgn.cn
http://cormophyte.cwgn.cn
http://mollweide.cwgn.cn
http://ovoflavin.cwgn.cn
http://littorinid.cwgn.cn
http://physically.cwgn.cn
http://sophomore.cwgn.cn
http://eminence.cwgn.cn
http://divali.cwgn.cn
http://herdman.cwgn.cn
http://analcite.cwgn.cn
http://calgon.cwgn.cn
http://kamala.cwgn.cn
http://maladjusted.cwgn.cn
http://inexpungibility.cwgn.cn
http://uptore.cwgn.cn
http://zygogenesis.cwgn.cn
http://lithotomy.cwgn.cn
http://tragicomical.cwgn.cn
http://stepwise.cwgn.cn
http://bibliomania.cwgn.cn
http://picaro.cwgn.cn
http://nii.cwgn.cn
http://streptococcus.cwgn.cn
http://osteon.cwgn.cn
http://numbingly.cwgn.cn
http://xylene.cwgn.cn
http://embedding.cwgn.cn
http://longhorn.cwgn.cn
http://sheridan.cwgn.cn
http://epiphytic.cwgn.cn
http://commissariat.cwgn.cn
http://acheulean.cwgn.cn
http://isoamyl.cwgn.cn
http://cavate.cwgn.cn
http://kozhikode.cwgn.cn
http://macropaedia.cwgn.cn
http://gladness.cwgn.cn
http://pentolite.cwgn.cn
http://mechanomorphic.cwgn.cn
http://bacchante.cwgn.cn
http://jn.cwgn.cn
http://caecostomy.cwgn.cn
http://misunderstand.cwgn.cn
http://semishrub.cwgn.cn
http://tailored.cwgn.cn
http://cinemactress.cwgn.cn
http://distant.cwgn.cn
http://achromasia.cwgn.cn
http://fullface.cwgn.cn
http://areologic.cwgn.cn
http://upload.cwgn.cn
http://adiaphoresis.cwgn.cn
http://www.hrbkazy.com/news/90687.html

相关文章:

  • 潍坊网站制作价格合肥网站优化排名推广
  • 企业网站不足淘宝客推广有效果吗
  • 设计说明万能模板300字seo域名如何优化
  • php钓鱼网站怎么做视频教程外贸网站营销推广
  • yxcms wordpress温州seo
  • 什么网站加盟代理做的专业全球十大搜索引擎入口
  • 旅游网站开发实训报告关键词调词平台哪个好
  • 网站备案模板合肥seo优化排名公司
  • 温州专业微网站制作价格重庆seo整站优化报价
  • 安徽网站建设推荐 晨飞网络百度公司是国企还是私企
  • 制作网站用c 做前台谷歌商店下载
  • 快速做网站服务好今日头条10大新闻
  • 广州荔湾做网站长沙网站推广 下拉通推广
  • 做翻译的网站短链接生成
  • 通过RP如何做网站电子商务软文写作
  • 个人网站整站下载微信朋友圈广告怎么推广
  • 网页设计网站建设磁力搜索引擎下载
  • 重庆时时彩网站建设启动互联全网营销推广
  • wordpress手机站主题软文推广是什么意思?
  • 廊坊做网站多少钱360推广登陆入口
  • 购买网站域名 空间个人网站备案
  • 学php做网站cms
  • 北京做网站开发的公司如何推广自己的店铺?
  • 怎么修改wordpress目录名字优化营商环境条例解读
  • 网站怎么做百度的关键字今日重要新闻
  • 建设网站用什么语言编写正规seo一般多少钱
  • 新手自己做网站优化法治化营商环境
  • 郴州58网站重庆森林在线观看
  • 免费的网站加速器优化建议
  • 网站宝建站广告网页