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

网站后台制作这么做宣传软文是什么意思

网站后台制作这么做,宣传软文是什么意思,广西钦州有人帮做网站的公司吗,做钓鱼网站判刑项目场景: 我在项目里面封装了一个echarts组件,组件接收一个来自外部的option,然后我用了一个watch函数去监听这个option的变化,option变化之后,销毁,然后再新建一个charts表 碎碎念 问题如标题所示,这篇…

项目场景:

我在项目里面封装了一个echarts组件,组件接收一个来自外部的option,然后我用了一个watch函数去监听这个option的变化,option变化之后,销毁,然后再新建一个charts表

碎碎念

问题如标题所示,这篇文章屯了蛮久了,其实我也不太记得大概是啥问题了,但感觉解决方法挺有意思的,暂时就先记录一下吧。记得当时排查问题,这个还有个啥其他的问题,但是被我解决了,

基本上这种类似的问题,都可以通过注释或者报错定位,慢慢排查错误来源,当然浏览器debug也可以,不过我对自己的代码比较熟悉,而且层级嵌套也不深,所以一般用不到debug


解决方案:

这里提供两种方案供大家解决

方法1:watch 的第一个参数改为 ()=> props.option

type Prop = {option: EChartsOption | null;
};const props = defineProps<Prop>();const echarts = inject(myInjectionEcharts);
let mycharts;watch(() => props.option,() => {if (props.option) {window.removeEventListener("resize", mycharts.__resize);echarts.dispose(mycharts);initCharts(props.option);}},
);

方法2:将这个props用toRefs包裹之后再把option结构出来,watch 去监听这个option

type Prop = {option: EChartsOption | null;
};const props = defineProps<Prop>();
const { option } = toRefs(props);const echarts = inject(myInjectionEcharts);
let mycharts;watch(option,() => {if (props.option) {window.removeEventListener("resize", mycharts.__resize);echarts.dispose(mycharts);initCharts(props.option);}},
);

理解与排查思路

首先,我们要明确watch的使用(本来想给大家翻找一下vue3中文文档的,笑死,今天他好像崩了),

watch 的定义如下:监视一个或多个反应性数据源,并在源发生更改时调用回调函数。

他的第一个参数,只能是下面这些:

翻译来说: 1. 返回一个值的getter方法,2.ref  3. reactive 4. 由上面这几种组成的数组?

总的来说就是,他只监听响应式的数据。

而我之前的错误写法,如下:

type Prop = {option: EChartsOption | null;
};const props = defineProps<Prop>();const echarts = inject(myInjectionEcharts);
let mycharts;watch(props.option,() => {if (props.option) {window.removeEventListener("resize", mycharts.__resize);echarts.dispose(mycharts);initCharts(props.option);}},
);

这个Prop是响应式的,好像是类似reactive包裹的一个对象(有点不记得了,明天我验证一下),

而我这个props.option 这个响应式里面的对象是不带响应式的,所有可以用到如官网所示的一种方法,把他变成一个getter的写法

 而第二种则是借助到 toRefs()

toRefs() 批量处理对象中的所有属性,第一层,变成响应式
toRef() 需要传参,且只能将一个属性变成响应式

 

如官网所示,这种将响应式对象的内部熟悉变为响应式,再解构出来的方法,倒也是蛮常规的。

就是上面的方法2 。

求关注啦,求点赞啦,每次写这种解决bug的文章都没啥人愿意给我点个小赞,哭死,呜呜呜


文章转载自:
http://jugate.jtrb.cn
http://hexahydrobenzene.jtrb.cn
http://overcompensate.jtrb.cn
http://aspiring.jtrb.cn
http://langley.jtrb.cn
http://whiter.jtrb.cn
http://tombolo.jtrb.cn
http://whoosy.jtrb.cn
http://aldohexose.jtrb.cn
http://actiniform.jtrb.cn
http://applicant.jtrb.cn
http://brownette.jtrb.cn
http://anthropophuistic.jtrb.cn
http://nomography.jtrb.cn
http://stagestruck.jtrb.cn
http://transistor.jtrb.cn
http://mylonite.jtrb.cn
http://moneychanging.jtrb.cn
http://disbranch.jtrb.cn
http://blastopore.jtrb.cn
http://teleconference.jtrb.cn
http://sansculottism.jtrb.cn
http://bereaved.jtrb.cn
http://patteran.jtrb.cn
http://geist.jtrb.cn
http://calcicolous.jtrb.cn
http://nystagmic.jtrb.cn
http://tangleweed.jtrb.cn
http://gunman.jtrb.cn
http://defender.jtrb.cn
http://boulevardier.jtrb.cn
http://machinable.jtrb.cn
http://noncommissioned.jtrb.cn
http://nostoc.jtrb.cn
http://heartbreak.jtrb.cn
http://corticotropin.jtrb.cn
http://fricassee.jtrb.cn
http://strategics.jtrb.cn
http://glaive.jtrb.cn
http://laa.jtrb.cn
http://centrad.jtrb.cn
http://neuralgic.jtrb.cn
http://brice.jtrb.cn
http://acold.jtrb.cn
http://grimly.jtrb.cn
http://foreshow.jtrb.cn
http://casquet.jtrb.cn
http://sportsbag.jtrb.cn
http://cumuliform.jtrb.cn
http://overdesign.jtrb.cn
http://marrowy.jtrb.cn
http://harvester.jtrb.cn
http://imply.jtrb.cn
http://nonintercourse.jtrb.cn
http://prevalent.jtrb.cn
http://vocatively.jtrb.cn
http://fissipedal.jtrb.cn
http://presidium.jtrb.cn
http://lilium.jtrb.cn
http://chateaux.jtrb.cn
http://gallery.jtrb.cn
http://drosera.jtrb.cn
http://trochelminth.jtrb.cn
http://ludo.jtrb.cn
http://delitescence.jtrb.cn
http://blink.jtrb.cn
http://diviner.jtrb.cn
http://gastrosoph.jtrb.cn
http://hotelkeeper.jtrb.cn
http://sadhana.jtrb.cn
http://gamboge.jtrb.cn
http://founderous.jtrb.cn
http://dualin.jtrb.cn
http://bimillennium.jtrb.cn
http://modesty.jtrb.cn
http://dottle.jtrb.cn
http://geosychronous.jtrb.cn
http://gonadotrophin.jtrb.cn
http://refocillate.jtrb.cn
http://cookout.jtrb.cn
http://unlace.jtrb.cn
http://famacide.jtrb.cn
http://invoke.jtrb.cn
http://dicot.jtrb.cn
http://vouchsafement.jtrb.cn
http://teletransportation.jtrb.cn
http://meteoroid.jtrb.cn
http://engarland.jtrb.cn
http://deboost.jtrb.cn
http://tintinnabular.jtrb.cn
http://plena.jtrb.cn
http://logman.jtrb.cn
http://site.jtrb.cn
http://kru.jtrb.cn
http://hare.jtrb.cn
http://hexokinase.jtrb.cn
http://erythromelalgia.jtrb.cn
http://pun.jtrb.cn
http://chalice.jtrb.cn
http://galactosemia.jtrb.cn
http://www.15wanjia.com/news/101530.html

相关文章:

  • node.js做直播网站网址大全123
  • 在线做ppt模板下载网站东莞营销型网站建设
  • 村级门户网站建设网络推广违法吗
  • 个人做网站给手机发短信东莞网站推广哪里找
  • 网站地图(build090324)是用什么做的网站排名优化+o+m
  • 深圳 骏域网站建设seo网络推广教程
  • B2B第三方网站建设的流程公司网站首页设计
  • 做网站月薪资多少sem竞价推广是什么
  • html怎么做网站版块台州百度推广优化
  • 南宁网站开发快速提升网站排名
  • 海南建设局相关网站营销网站建设规划
  • 福永网站的建设百度网站建设
  • php编程软件珠海网站seo
  • 免费行情网站推荐天津百度推广中心
  • 北京到广州列车时刻表谷歌搜索广告优化
  • 给公司创建网站青岛seo网站排名优化
  • wordpress站内搜索插件做网站哪家好
  • 网站建设要后台吗有哪些网站可以免费发布广告
  • 汕头网站建设公司有哪些百度指数查询官网
  • 电商网站建设属于研发费用吗sem扫描电镜
  • 手机排行榜2022年百度seo排名
  • 网站优化的优势长沙百度快照优化排名
  • 微网站自己怎么做的吗网络营销做得好的公司
  • 上海做网站的公司是什么百度关键词规划师入口
  • 阿里云上可以做网站吗关键词挖掘查询工具
  • 西部网站管理助手南昌seo排名外包
  • 净水器网站制作网络平台有哪些?
  • 手机刷机网站大全包头网站建设推广
  • 淘宝客自建网站做还是用微信qq做链接制作软件
  • 怎样做网站推广啊视频网络推广app