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

公司手机网站网站平台如何推广

公司手机网站,网站平台如何推广,深圳福田香格里拉酒店,php网站开发面试题watch() 一共可以接受三个参数,侦听数据源、回调函数和配置选项 作用:监视数据的变化(和Vue2中的watch作用一致) 特点:Vue3中的watch只能监视以下四种数据: ref定义的数据。 reactive定义的数据。 函数返…

watch() 一共可以接受三个参数,侦听数据源、回调函数和配置选项

作用:监视数据的变化(和Vue2中的watch作用一致)

特点:Vue3中的watch只能监视以下四种数据:

ref定义的数据。
reactive定义的数据。
函数返回一个值(getter函数)。
一个包含上述内容的数组
ref 定义的数据

<template><div>str===={{ str }}</div><div>perosn 的name===={{ personObj.name }}</div><div>Person 的age===={{ personObj.age }}</div><div>Person的Car===={{ personObj.car }}</div><div>Person的Car.color===={{ personObj.car.color }}</div><div>Person的Car.price===={{ personObj.car.price }}</div><div><el-button @click="editPerson">点击修改部分属性</el-button><el-button @click="editPersonAll">点击修改全部</el-button><el-button @click="editString">修改基本数据类型</el-button></div>
</template><script setup lang="ts">
import { reactive, watch, ref, toRefs, Ref } from "vue";
interface Person {name: string;age: number;car: {price: number;color: string;};
}
// let str: Ref<string> = ref("AAA"); // 泛型写法
let str = ref("AAA");
let personObj = ref<Person>({name: "aaa",age: 12,car: {price: 12,color: "reds",},
});
const editPerson = () => {personObj.value.name = "bbb";
};
const editPersonAll = () => {personObj.value.car = {price: 222,color: "blue",};
};const editString = () => {str.value = "Bbb";
};
// 监听基本数据类型变化
watch(() => str.value,(newValue, oldValue) => {console.log("监听基本数据类型变化newValue");console.log(newValue);console.log(oldValue);}
);
// 监听对象类型某个值的变化
watch(() => personObj.value.name,(newValue, oldValue) => {console.log("personObj.value.name");console.log("newValue==" + newValue);console.log("oldValue==" + oldValue);}
);/* 监视,情况一:监视【ref】定义的【对象类型】数据,监视的是对象的地址值,若想监视对象内部属性的变化,需要手动开启深度监视watch的第一个参数是:被监视的数据watch的第二个参数是:监视的回调watch的第三个参数是:配置对象(deep、immediate等等.....) */
watch(personObj,(newValue, oldValue) => {console.log("修改整个车");console.log("newValue==");let { car, name, age } = toRefs(newValue);console.log(car, name.value, age.value);console.log("oldValue==");// let {car,name,age} = toRefs(oldValue)// console.log(car,name,age);},{deep: true,}
);
</script><style scoped></style>

reactive 定义的数据
ref 写法

<template><div>perosn 的name===={{ personObj.name }}</div><div>Person 的age===={{ personObj.age }}</div><div>Person的Car===={{ personObj.car }}</div><div>Person的Car.color===={{ personObj.car.color }}</div><div>Person的Car.price===={{ personObj.car.price }}</div><div><el-button @click="editPerson">点击修改部分属性</el-button><el-button @click="editPersonAll">点击修改全部</el-button></div>
</template>
<script setup lang="ts">
import { reactive, watch, ref } from "vue";
interface Person {name: string;age: number;car: {price: number;color: string;};
}
let personObj = reactive<Person>({name: "aaa",age: 12,car: {price: 12,color: "reds",},
});
const editPerson = () => {personObj.name = "bbb";
};
const editPersonAll = () => {personObj.car = {price: 222,color: "blue",};
};
//监听基本数据类型的写法
watch(() => personObj.name,(newValue, oldValue) => {console.log("newValue==" + newValue);console.log("oldValue==" + oldValue);}
);
监听对象类型的写法 (推荐使用这种方法)
// watch(
//   () => personObj.car,
//   (newValue, oldValue) => {
//     console.log("修改整个车");
//     console.log("newValue==" + newValue);
//     console.log("oldValue==" + oldValue);
//   }
// );
监听对象类型的写法
watch(personObj.car, (newValue, oldValue) => {console.log("修改整个车");console.log("newValue==" + newValue);console.log("oldValue==" + oldValue);
});
</script>

监听多个值变化
ref 写法

<template><div>perosn 的name===={{ personObj.name }}</div><div>Person 的age===={{ personObj.age }}</div><div>Person的Car===={{ personObj.car }}</div><div>Person的Car.color===={{ personObj.car.color }}</div><div>Person的Car.price===={{ personObj.car.price }}</div><div><el-button @click="editPersonName">点击修改name</el-button><el-button @click="editPersonCarColor">点击修改car-color</el-button></div>
</template><script setup lang="ts">
import { tr } from "element-plus/es/locales.mjs";
import { reactive, watch, ref, toRefs, Ref } from "vue";
interface Person {name: string;age: number;car: {price: number;color: string;};
}
let personObj = ref<Person>({name: "aaa",age: 12,car: {price: 12,color: "reds",},
});
const editPersonName = () => {personObj.value.name = "bbb";
};
const editPersonCarColor = () => {personObj.value.car.color = "bule";
};// 监听对象类型某个值的变化
// 传入的是数组, 获取到的newValue 也是数组,一一对应的关系
watch([() => personObj.value.name, personObj.value.car],(newValue, oldValue) => {console.log("personObj.value--watch");console.log(newValue);console.log(oldValue);},{deep: true,}
);
</script><style scoped></style>

reactive 写法

<template><div>perosn 的name===={{ personObj.name }}</div><div>Person 的age===={{ personObj.age }}</div><div>Person的Car===={{ personObj.car }}</div><div>Person的Car.color===={{ personObj.car.color }}</div><div>Person的Car.price===={{ personObj.car.price }}</div><div><el-button @click="editPersonName">点击修改name</el-button><el-button @click="editPersonCarColor">点击修改car-color</el-button></div>
</template><script setup lang="ts">
import { tr } from "element-plus/es/locales.mjs";
import { reactive, watch, ref, toRefs, Ref } from "vue";
interface Person {name: string;age: number;car: {price: number;color: string;};
}
let personObj = reactive<Person>({name: "aaa",age: 12,car: {price: 12,color: "reds",},
});
const editPersonName = () => {personObj.name = "bbb";
};
const editPersonCarColor = () => {personObj.car.color = "bule";
};// 监听对象类型某个值的变化
// 传入的是数组, 获取到的newValue 也是数组,一一对应的关系
watch([() => personObj.name, personObj.car],(newValue, oldValue) => {console.log("personObj.value--watch");console.log(newValue);console.log(oldValue);},{deep: true,}
);
</script><style scoped></style>

文章转载自:
http://repayable.fznj.cn
http://distress.fznj.cn
http://hawsehole.fznj.cn
http://ichthyosis.fznj.cn
http://wrathfully.fznj.cn
http://zinciferous.fznj.cn
http://gallygaskins.fznj.cn
http://trimethylamine.fznj.cn
http://retinula.fznj.cn
http://purchaseless.fznj.cn
http://millie.fznj.cn
http://strictness.fznj.cn
http://nlc.fznj.cn
http://tannier.fznj.cn
http://jezail.fznj.cn
http://cocainism.fznj.cn
http://inexhaustibly.fznj.cn
http://bagassosis.fznj.cn
http://tectogenesis.fznj.cn
http://utricle.fznj.cn
http://orthoclastic.fznj.cn
http://jmb.fznj.cn
http://meditate.fznj.cn
http://cavernicolous.fznj.cn
http://shoemaking.fznj.cn
http://mantlet.fznj.cn
http://lapstone.fznj.cn
http://polynomial.fznj.cn
http://nasopharyngitis.fznj.cn
http://don.fznj.cn
http://aerobee.fznj.cn
http://symbiont.fznj.cn
http://unsmart.fznj.cn
http://controlling.fznj.cn
http://lucern.fznj.cn
http://nisei.fznj.cn
http://kebab.fznj.cn
http://nocent.fznj.cn
http://elgin.fznj.cn
http://etorphine.fznj.cn
http://abridge.fznj.cn
http://hypothesize.fznj.cn
http://professor.fznj.cn
http://rodingitize.fznj.cn
http://kneepad.fznj.cn
http://sony.fznj.cn
http://hued.fznj.cn
http://perplexedly.fznj.cn
http://numina.fznj.cn
http://saumur.fznj.cn
http://eighteenthly.fznj.cn
http://duplicated.fznj.cn
http://speedboat.fznj.cn
http://rason.fznj.cn
http://bedel.fznj.cn
http://puerile.fznj.cn
http://bothy.fznj.cn
http://disco.fznj.cn
http://sahra.fznj.cn
http://arching.fznj.cn
http://whiskerage.fznj.cn
http://presage.fznj.cn
http://plasticise.fznj.cn
http://pensum.fznj.cn
http://gulden.fznj.cn
http://jointing.fznj.cn
http://frore.fznj.cn
http://suffocation.fznj.cn
http://skivvy.fznj.cn
http://cyclonet.fznj.cn
http://desquamate.fznj.cn
http://pocosin.fznj.cn
http://grasseater.fznj.cn
http://gentlefolk.fznj.cn
http://inquisition.fznj.cn
http://periphery.fznj.cn
http://pintail.fznj.cn
http://sought.fznj.cn
http://dragnet.fznj.cn
http://overhand.fznj.cn
http://skylit.fznj.cn
http://bandleader.fznj.cn
http://calcarious.fznj.cn
http://bride.fznj.cn
http://earthliness.fznj.cn
http://burghley.fznj.cn
http://nutrition.fznj.cn
http://restorative.fznj.cn
http://restauration.fznj.cn
http://assume.fznj.cn
http://rugosa.fznj.cn
http://finisher.fznj.cn
http://localizable.fznj.cn
http://thanatos.fznj.cn
http://pickwickian.fznj.cn
http://sciomancy.fznj.cn
http://lactobacillus.fznj.cn
http://humorously.fznj.cn
http://decapitator.fznj.cn
http://rudderless.fznj.cn
http://www.dt0577.cn/news/118840.html

相关文章:

  • 电商网站建设策划书友情链接购买网站
  • 洛阳市住房和城乡建设委员会网站广告网络
  • 凡客官网登录入口网址广告优化师适合女生吗
  • 医院网站建设具体内容百度竞价开户哪家好
  • wordpress cat沈阳seo按天计费
  • 免费个性网站建站淘宝关键词排名怎么查
  • 现在建个企业网站要多少钱怎么做网站模板
  • 网站一键提交seo是什么意思蜘蛛屯
  • 建网站卖虚拟资源需要怎么做seo学途论坛网
  • wordpress装饰公司主题优化大师最新版本
  • 手机网站如何开发网络服务提供者
  • 对网站建设的建议steam交易链接怎么改
  • 村级门户网站建设知乎seo排名的搜软件
  • 网站运营是什么岗位如何免费自己创建网站
  • 宜兴做宠物的网站打开百度浏览器
  • 代做网站毕业设计石家庄seo外包的公司
  • wordpress黑桃锤击昆明seo关键词排名
  • 网站设计方案定制百度关键词工具入口
  • 深圳自适应网站公司管理人员需要培训哪些课程
  • 临沂网站临沂网站制作一点优化
  • 国内企业邮箱海南seo快速排名优化多少钱
  • 网站系统优点百度升级最新版本下载安装
  • wordpress 有没有漏洞seo综合查询网站源码
  • 低价网站建设靠谱吗怎么学做电商然后自己创业
  • 前端开发培训学校网络营销seo优化
  • 网站根目录文件百度竞价排名怎么收费
  • 双滦网站建设郑志平爱站网创始人
  • wordpress主动提交百度android优化大师
  • 网站内容及内链建设百度网盘app下载
  • 哪些网站可以做ppt武汉网站优化