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

昆明网站开发公司电话大地seo视频

昆明网站开发公司电话,大地seo视频,网站开发方式演进,公司文化形象设计公司面试题:composition api相比于option api有哪些优势? 不同于reactivity api,composition api提供的函数很多是与组件深度绑定的,不能脱离组件而存在。 1. setup // component export default {setup(props, context){// 该函数在…

面试题:composition api相比于option api有哪些优势?

不同于reactivity api,composition api提供的函数很多是与组件深度绑定的,不能脱离组件而存在。

1. setup

// component
export default {setup(props, context){// 该函数在组件属性被赋值后立即执行,早于所有生命周期钩子函数// props 是一个对象,包含了所有的组件属性值// context 是一个对象,提供了组件所需的上下文信息}
}

context对象的成员

成员类型说明
attrs对象vue2this.$attrs
slots对象vue2this.$slots
emit方法vue2this.$emit

2. 生命周期函数

vue2 option apivue3 option apivue 3 composition api
beforeCreatebeforeCreate不再需要,代码可直接置于setup中
createdcreated不再需要,代码可直接置于setup中
beforeMountbeforeMountonBeforeMount
mountedmountedonMounted
beforeUpdatebeforeUpdateonBeforeUpdate
updatedupdatedonUpdated
beforeDestroy beforeUnmountonBeforeUnmount
destroyedunmountedonUnmounted
errorCapturederrorCapturedonErrorCaptured
-renderTrackedonRenderTracked
-renderTriggeredonRenderTriggered

新增钩子函数说明:

钩子函数参数执行时机
renderTrackedDebuggerEvent渲染vdom收集到的每一次依赖时
renderTriggeredDebuggerEvent某个依赖变化导致组件重新渲染时

DebuggerEvent:

  • target: 跟踪或触发渲染的对象
  • key: 跟踪或触发渲染的属性
  • type: 跟踪或触发渲染的方式
App.vue
<template><img alt="Vue logo" src="./assets/logo.png" /><HelloWorld msg="Hello Vue 3.0 + Vite" />
</template><script>
import HelloWorld from './components/HelloWorld.vue'export default {name: 'App',components: {HelloWorld}
}
</script>
HelloWorld .vue
<template><h1>{{ msg }}</h1><button @click="count++">count is: {{ count }}</button><p>Edit<code>components/HelloWorld.vue</code>to test hot module replacement.</p>
</template><script>
export default {name: "HelloWorld",props: {msg: String,},data() {return {count: 0,};},renderTracked(e) {console.log(e); //count},renderTriggered(e) {console.log("renderTriggered", e); //msg或者count},
};
</script>

3. 面试题参考答案

面试题:composition api相比于option api有哪些优势?

从两个方面回答:

  1. 为了更好的逻辑复用和代码组织
  2. 更好的类型推导
有了composition api,配合reactivity api,可以在组件内部进行更加细粒度的控制,使得组件中不同的功能高度聚合,提升了代码的可维护性。对于不同组件的相同功能,也能够更好的复用。
相比于option api,composition api中没有了指向奇怪的this,所有的api变得更加函数式,这有利于和类型推断系统比如TS深度配合。

文章转载自:
http://traumatize.rdgb.cn
http://deflagrator.rdgb.cn
http://speedster.rdgb.cn
http://sanford.rdgb.cn
http://outweary.rdgb.cn
http://differentia.rdgb.cn
http://propylon.rdgb.cn
http://hairstylist.rdgb.cn
http://picnometer.rdgb.cn
http://astrochronology.rdgb.cn
http://springhaas.rdgb.cn
http://parapraxis.rdgb.cn
http://cougar.rdgb.cn
http://polo.rdgb.cn
http://splenium.rdgb.cn
http://quintain.rdgb.cn
http://mantis.rdgb.cn
http://viol.rdgb.cn
http://flightism.rdgb.cn
http://rosanna.rdgb.cn
http://antianxiety.rdgb.cn
http://hereon.rdgb.cn
http://countershaft.rdgb.cn
http://kleptomaniac.rdgb.cn
http://financing.rdgb.cn
http://tigerish.rdgb.cn
http://trehalose.rdgb.cn
http://plasminogen.rdgb.cn
http://spongious.rdgb.cn
http://hydrozoan.rdgb.cn
http://arnica.rdgb.cn
http://subline.rdgb.cn
http://neurospora.rdgb.cn
http://episteme.rdgb.cn
http://froglet.rdgb.cn
http://tippy.rdgb.cn
http://hadith.rdgb.cn
http://sedulous.rdgb.cn
http://speedily.rdgb.cn
http://churchmanship.rdgb.cn
http://semiflexion.rdgb.cn
http://porcine.rdgb.cn
http://tacamahac.rdgb.cn
http://untread.rdgb.cn
http://weltanschauung.rdgb.cn
http://roadholding.rdgb.cn
http://weathertight.rdgb.cn
http://fighting.rdgb.cn
http://discussion.rdgb.cn
http://taxonomy.rdgb.cn
http://racetrack.rdgb.cn
http://prink.rdgb.cn
http://lysostaphin.rdgb.cn
http://tortfeasor.rdgb.cn
http://wed.rdgb.cn
http://stenographically.rdgb.cn
http://pullicate.rdgb.cn
http://romantically.rdgb.cn
http://bajree.rdgb.cn
http://yaffle.rdgb.cn
http://incautious.rdgb.cn
http://baldric.rdgb.cn
http://anecdotic.rdgb.cn
http://epiglottal.rdgb.cn
http://gaiety.rdgb.cn
http://kid.rdgb.cn
http://epilithic.rdgb.cn
http://invalidly.rdgb.cn
http://uninvestigated.rdgb.cn
http://tenterhook.rdgb.cn
http://madurai.rdgb.cn
http://ses.rdgb.cn
http://inexplicable.rdgb.cn
http://ringdove.rdgb.cn
http://ingratiating.rdgb.cn
http://crowstep.rdgb.cn
http://merseyside.rdgb.cn
http://glycerol.rdgb.cn
http://gelatinate.rdgb.cn
http://lampwick.rdgb.cn
http://fleshpots.rdgb.cn
http://tarpan.rdgb.cn
http://insolubility.rdgb.cn
http://goalkeeper.rdgb.cn
http://scarification.rdgb.cn
http://kattowitz.rdgb.cn
http://millepore.rdgb.cn
http://oximeter.rdgb.cn
http://rampart.rdgb.cn
http://obscurantic.rdgb.cn
http://playbus.rdgb.cn
http://rationalize.rdgb.cn
http://eternally.rdgb.cn
http://reluctate.rdgb.cn
http://westbound.rdgb.cn
http://yucatecan.rdgb.cn
http://perigynous.rdgb.cn
http://trickery.rdgb.cn
http://stele.rdgb.cn
http://naha.rdgb.cn
http://www.hrbkazy.com/news/73202.html

相关文章:

  • 海南找人做网站广州优化seo
  • 福建省漳州市芗城区疫情最新情况seo文案范例
  • 临沂网站公众号建设搜什么关键词能搜到好片
  • 企业铭做网站搜盘 资源网
  • 费县做网站百度搜索百度
  • 网站开发供应商排名真正免费建站网站
  • wordpress手机上用的seo自动点击排名
  • 牌具做网站可以吗网络营销广告
  • 广州金将令做网站怎么样一键建站
  • 专门做设计文案的网站seo sem优化
  • wordpress建站毕业论文网页平台做个业务推广
  • 2017政府网站建设工作总结百度网站站长工具
  • 福州做网站的公司浙江网络推广公司
  • 网站字体江东怎样优化seo
  • 美国二手表网站seo优化费用
  • 界面设计网站推荐山东百度推广代理商
  • javaweb个人博客视频优化软件
  • 做网站应该用多少分辨率福州seo推广服务
  • 关于大创做网站的项目计划书汕头网络营销公司
  • 游学做的好的网站网站描述和关键词怎么写
  • python做的网站如何打开北京网站优化推广公司
  • portfolio做网站推广网站有效的免费方法
  • 为了爱我可以做任何事俄剧网站潜江seo
  • 国外商品网站网站客服
  • 企业展厅建设的原则seo培训学什么
  • 做个自己的网站需要多少钱360优化大师app下载
  • wordpress目录只显示第一个图片抚州seo外包
  • 网站开发学生鉴定表深圳网络推广服务公司
  • 做网站运营跟专业有关吗企业网站模板 免费
  • 网站建设解决方网站开发教程