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

jsp网站开发难吗访客留言网站

jsp网站开发难吗,访客留言网站,制作的大型网站多少钱,制作图片的app免费watch() 一共可以接受三个参数#xff0c;侦听数据源、回调函数和配置选项 作用#xff1a;监视数据的变化#xff08;和Vue2中的watch作用一致#xff09; 特点#xff1a;Vue3中的watch只能监视以下四种数据#xff1a; ref定义的数据。 reactive定义的数据。 函数返…watch() 一共可以接受三个参数侦听数据源、回调函数和配置选项 作用监视数据的变化和Vue2中的watch作用一致 特点Vue3中的watch只能监视以下四种数据 ref定义的数据。 reactive定义的数据。 函数返回一个值getter函数。 一个包含上述内容的数组 ref 定义的数据 templatedivstr{{ str }}/divdivperosn 的name{{ personObj.name }}/divdivPerson 的age{{ personObj.age }}/divdivPerson的Car{{ personObj.car }}/divdivPerson的Car.color{{ personObj.car.color }}/divdivPerson的Car.price{{ personObj.car.price }}/divdivel-button clickeditPerson点击修改部分属性/el-buttonel-button clickeditPersonAll点击修改全部/el-buttonel-button clickeditString修改基本数据类型/el-button/div /templatescript setup langts import { reactive, watch, ref, toRefs, Ref } from vue; interface Person {name: string;age: number;car: {price: number;color: string;}; } // let str: Refstring ref(AAA); // 泛型写法 let str ref(AAA); let personObj refPerson({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,} ); /scriptstyle scoped/style reactive 定义的数据 ref 写法 templatedivperosn 的name{{ personObj.name }}/divdivPerson 的age{{ personObj.age }}/divdivPerson的Car{{ personObj.car }}/divdivPerson的Car.color{{ personObj.car.color }}/divdivPerson的Car.price{{ personObj.car.price }}/divdivel-button clickeditPerson点击修改部分属性/el-buttonel-button clickeditPersonAll点击修改全部/el-button/div /template script setup langts import { reactive, watch, ref } from vue; interface Person {name: string;age: number;car: {price: number;color: string;}; } let personObj reactivePerson({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 写法 templatedivperosn 的name{{ personObj.name }}/divdivPerson 的age{{ personObj.age }}/divdivPerson的Car{{ personObj.car }}/divdivPerson的Car.color{{ personObj.car.color }}/divdivPerson的Car.price{{ personObj.car.price }}/divdivel-button clickeditPersonName点击修改name/el-buttonel-button clickeditPersonCarColor点击修改car-color/el-button/div /templatescript setup langts 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 refPerson({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,} ); /scriptstyle scoped/style reactive 写法 templatedivperosn 的name{{ personObj.name }}/divdivPerson 的age{{ personObj.age }}/divdivPerson的Car{{ personObj.car }}/divdivPerson的Car.color{{ personObj.car.color }}/divdivPerson的Car.price{{ personObj.car.price }}/divdivel-button clickeditPersonName点击修改name/el-buttonel-button clickeditPersonCarColor点击修改car-color/el-button/div /templatescript setup langts 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 reactivePerson({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,} ); /scriptstyle scoped/style
http://www.w-s-a.com/news/835367/

相关文章:

  • 手机上怎么上传网站吗工程信息网站建设
  • 用手机建网站微信手机网站流程
  • 专注软件优化分享的网站梧州网页设计
  • 长春火车站和高铁站是一个站吗公司名称注册查询系统
  • 便利的集团网站建设网页的依托网站
  • 茶叶网站建设题库制作助手app
  • 网站建设栏目层级北京网站搭建公司电话
  • 网站开发运营经理打开百度竞价页面是网站是什么
  • 国内最专业的设计网站建设现在用什么语言做网站
  • 湖南网站开发 岚鸿象山县建设工程招投标网站
  • 长沙免费网站排名wordpress 教学
  • 专门做app的网站html代码是什么
  • 临沂网站制作建设欧米茄表官网
  • 北京模板网站开发全包网站建设的第三方平台
  • 在凡科做的网站怎么推广网页模板下载 免费 html
  • 有关网站建设的标题仿亿欧网wordpress
  • 网站建设公司销售招聘常用的搜索引擎有哪些?
  • wordpress中.htaccess新上线的网站怎么做优化
  • 家教网站怎么做网站建设品牌推荐
  • 青岛做外贸网站建设茶叶公司网站建设策划书
  • 个人电脑做网站主机三合一网站
  • 用html框架做网站怎么在.Net中做团购网站
  • 怎样建一个自己公司的网站制作网站需要钱吗
  • 联盟网站制作wap网站制作公司
  • 美丽乡村建设发展论坛网站wordpress 仿站 教程网
  • 浙江省建设注册管理中心网站首页优设设计网站导航
  • 台州小型网站建设国内免费的建网站平台
  • 自己做网站不推广网站建设工作室发展
  • 有女人和马做网站吗宁波seo优势
  • 网站做用户记录表电商运营推广计划方案