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

网站积分程序怎么建设红酒论坛网站建设

网站积分程序怎么建设,红酒论坛网站建设,网站上的楼价走势图怎么做,服装设计师有前途吗动态组件的基本使用 动态组件#xff08;Dynamic Components#xff09;是一种在 Vue 中根据条件或用户输入来动态渲染不同组件的技术。 在 Vue 中使用动态组件#xff0c;可以使用 元素#xff0c;并通过 is 特性绑定一个组件的名称或组件对象。通过在父组件中改变 is 特…动态组件的基本使用 动态组件Dynamic Components是一种在 Vue 中根据条件或用户输入来动态渲染不同组件的技术。 在 Vue 中使用动态组件可以使用 元素并通过 is 特性绑定一个组件的名称或组件对象。通过在父组件中改变 is 特性的值可以动态切换渲染的组件。 第一种写法 A.vue templatedivA component/div /templatescript setup langts/scriptstyle scoped/styleB.vue C.vue 同理 APP.vue templatediv styledisplay: flex;!-- class可以写两个一个静态一个动态 --div clickswitchCom(item, index) :class[active index ? active : ] classtabsv-for(item, index) in datadiv{{ item.name }}/div/div/divcomponent :iscomId/component /templatescript setup langts import { ref, reactive } from vue; import AVue from ./components/A.vue import BVue from ./components/B.vue import CVue from ./components/C.vue // 这里不需要将对象中所有数据变为响应式可以使用ref const comId ref(AVue) const active ref(0)const switchCom (item, index) {comId.value item.comactive.value index }const data reactive([{name: A,com: AVue},{name: B,com: BVue},{name: C,com: CVue} ]) /scriptstyle langscss scoped .active {background: blueviolet; }.tabs {border: 1px solid #ccc;padding: 5px 10px;margin: 5px;cursor: pointer;} /style第二种写法 APP.vue templatediv styledisplay: flex;!-- class可以写两个一个静态一个动态 --div clickswitchCom(item, index) :class[active index ? active : ] classtabsv-for(item, index) in datadiv{{ item.name }}/div/div/divcomponent :iscomId/component /templatescript setup langts // markRaw作用标记一个对象使其永远不会再成为响应式对象。 import { ref, reactive, markRaw, shallowRef } from vue;// 这里不需要将对象中所有数据变为响应式可以使用ref const comId shallowRef(AVue) const active ref(0)const switchCom (item, index) {comId.value item.comconsole.log(comId.value);active.value index }const data reactive([{name: A,com:AVue},{name: B,com:BVue},{name: C,com:CVue} ]) /scriptscript langts import AVue from ./components/A.vue import BVue from ./components/B.vue import CVue from ./components/C.vueexport default {components: {AVue,BVue,CVue} } /scriptstyle langscss scoped .active {background: blueviolet; }.tabs {border: 1px solid #ccc;padding: 5px 10px;margin: 5px;cursor: pointer;} /style性能优化 上述第一种写法代码会出现警告 输出 comId 的值出现 comId 的属性被劫持出现性能浪费 解决方法 使用markRaw和shallowRef这两个API App.vue templatediv styledisplay: flex;!-- class可以写两个一个静态一个动态 --div clickswitchCom(item, index) :class[active index ? active : ] classtabsv-for(item, index) in datadiv{{ item.name }}/div/div/divcomponent :iscomId/component /templatescript setup langts // markRaw作用标记一个对象使其永远不会再成为响应式对象。 import { ref, reactive, markRaw, shallowRef } from vue; import AVue from ./components/A.vue import BVue from ./components/B.vue import CVue from ./components/C.vue // 这里不需要将对象中所有数据变为响应式可以使用ref const comId shallowRef(AVue) const active ref(0)const switchCom (item, index) {comId.value item.comconsole.log(comId.value);active.value index }const data reactive([{name: A,com: markRaw(AVue)},{name: B,com: markRaw(BVue)},{name: C,com: markRaw(CVue)} ]) /scriptstyle langscss scoped .active {background: blueviolet; }.tabs {border: 1px solid #ccc;padding: 5px 10px;margin: 5px;cursor: pointer;} /style再次输出 comId 的值解决性能浪费的问题
http://www.yingshimen.cn/news/31475/

相关文章:

  • 信宜市建设局网站济南软件外包
  • 怎么做垂直门户网站怎样免费申请永久域名
  • 贵阳网站建设公司网站建设及服务合同书
  • 网站定制开发需要什么资质学编程需要具备什么条件
  • 网站定位广告响应式网站是指自适应吗
  • 网站建设后台管理流程网站服务器哪家好些
  • 哪些网站做免费送东西的广告6wordpress 发布 工具
  • 仿网站建设教程视频哪些网站可以做网站
  • wap网站模板下载龙岗网站建设哪家技术好
  • 云南旅行社网站建设一手房发帖网站怎样做
  • 家具网站开发设计论文网站建设耂首先金手指
  • 网站建设说明书怎么写手机自助建站永久免费
  • 做网站推广需要做什么石家庄城乡建设厅网站
  • h5网站用什么软件做东营市建设监理协会网站
  • 青浦徐泾网站建设抖音小程序推广怎么挂才有收益
  • 河北seo网站设计做直播网站视频教程
  • phpcms网站后台cms建站详细教程
  • 高米店网站建设公司站群源码
  • 网站建设 开票企业电话
  • 可以做视频推广的网站包装设计模板网站
  • 河南住房和城乡建设局网站php做商品网站
  • 电脑网站 源码临漳网站建站
  • 青岛做外贸网站建设融资平台有哪些
  • 网站云主机园林景观 网站建设
  • 教育培训手机网站模板下载微信管理系统平台电话
  • 四川网站推广公司90设计官网电脑版
  • 全球购物网站大全企业人员信息管理系统
  • dw自己做的网站手机进不去用什么软件做网站seo好
  • 海珠区有没有专门做网站的地方机械加工信息
  • 做网站排名优化的公司wordpress学生