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

网站模板商城下载微信

网站模板商城,下载微信,wordpress隐藏分区登录可见,怎么做网站咨询插槽可以让组件的使用者来决定组件中的某一块区域到底存放什么元素和内容。 使用插槽: 插槽的使用过程其实就是抽取共性、预留不同。将共同的元素、内容依然留在组件内进行封装;将不同的元素使用 slot 作为占位,让外部决定到底显示什么样的…

插槽可以让组件的使用者来决定组件中的某一块区域到底存放什么元素和内容。

使用插槽:

插槽的使用过程其实就是抽取共性、预留不同。将共同的元素、内容依然留在组件内进行封装;将不同的元素使用 slot 作为占位,让外部决定到底显示什么样的元素。

// App.vue
<template><!-- 2. 在父组件中调用子组件时,子组件开始标签和结束标签之间的内容将会被插入到子组件中插槽中 --><AppContent><button>按钮</button></AppContent><AppContent><a href="http:www.com">百度一下</a></AppContent>
</template><script>
import AppContent from './components/AppContent'export default {components: {AppContent,}
}
</script><style scoped>
</style>
// AppContent.vue
<template><div><h1>内容标题</h1><!-- 在子组件中预留插槽 --><slot></slot></div>
</template><script>
export default {
}
</script><style scoped>
</style>

在这里插入图片描述

插槽的默认内容:

<slot></slot>元素开始标签和结束标签之间的内容会作为插槽的默认内容,插槽的默认内容只会在没有提供插入的内容时显示。

// App.vue
<template><!-- 在父组件中调用子组件时,不提供插槽的内容 --><AppContent />
</template><script>
import AppContent from './components/AppContent'export default {components: {AppContent,}
}
</script><style scoped>
</style>
// AppContent.vue
<template><div><h1>内容标题</h1><slot><!-- <slot></slot> 开始标签和结束标签之间的内容会作为插槽的默认内容显示 --><div>这是插槽的默认内容</div></slot></div>
</template><script>
export default {
}
</script><style scoped>
</style>

在这里插入图片描述

具名插槽:

具名插槽:就是给插槽命名,通过 <slot> 元素的 name 属性可以给插槽命名。这样当一个组件中有多个插槽时,就可以区分出来要插入的内容是要插入哪个插槽中。

一个不带 name 的插槽,默认隐含的名字是 default。

// App.vue
<template><NavBar><!-- 2. 在父组件中,使用 template 元素包裹要插入到插槽中的内容,通过 v-slot:插槽的名称 来决定要插入哪个插槽中 --><!-- v-slot:[变量名] 可以通过这种方式来动态地绑定插槽的名称 --><!-- v-slot 的缩写为 # --><template v-slot:left><button>返回</button></template><template v-slot:center><input /></template><template v-slot:right><button>搜索</button></template></NavBar>
</template><script>
import NavBar from './components/NavBar'export default {components: {NavBar,}
}
</script><style scoped>
</style>
// NavBar.vue
<template><div class='navbar'><div class="left"><!-- 1. 在子组件中通过 name 属性给插槽命名 --><slot name="left"></slot></div>   <div class="center"><slot name="center"></slot></div> <div class="right"><slot name="right"></slot></div> </div>
</template><script>
export default {
}
</script><style scoped>
</style

作用域插槽:

作用域插槽的核心就是能够将子组件中的数据传递给父组件的插槽来使用。

// App.vue
<template><AppContent><!-- 2. 在父组件中,使用 template 元素包裹要插入到插槽中的内容,通过 v-slot:插槽名称="slotProps" 可以获取到子组件中指定插槽传递过来的数据 --><template v-slot:default="slotProps"><p>{{ slotProps.content }}</p></template></AppContent>
</template><script>
import AppContent from './components/AppContent'export default {components: {AppContent,}
}
</script><style scoped>
</style>
// AppContent.vue
<template><div><h1>子组件的标题</h1><!-- 1. 在子组件中,通过给 slot 元素添加属性的方式给父组件传递数据 --><slot content="子组件的内容"></slot></div>
</template><script>
export default {
}
</script><style scoped>
</style>

文章转载自:
http://dilative.c7498.cn
http://shoveller.c7498.cn
http://autogenic.c7498.cn
http://intuitional.c7498.cn
http://uninstructed.c7498.cn
http://encamp.c7498.cn
http://fishpot.c7498.cn
http://pyroconductivity.c7498.cn
http://jacamar.c7498.cn
http://metacentre.c7498.cn
http://wreckfish.c7498.cn
http://anechoic.c7498.cn
http://brimmer.c7498.cn
http://mitrailleuse.c7498.cn
http://tetrahedrite.c7498.cn
http://hmas.c7498.cn
http://magnus.c7498.cn
http://tower.c7498.cn
http://transparently.c7498.cn
http://khorramshahr.c7498.cn
http://underserved.c7498.cn
http://laurasia.c7498.cn
http://zenographic.c7498.cn
http://flocculent.c7498.cn
http://poster.c7498.cn
http://shortcake.c7498.cn
http://obsess.c7498.cn
http://joyful.c7498.cn
http://anticlinorium.c7498.cn
http://astrobiology.c7498.cn
http://dorbeetle.c7498.cn
http://foldaway.c7498.cn
http://padding.c7498.cn
http://inchoative.c7498.cn
http://modificator.c7498.cn
http://matchet.c7498.cn
http://illumination.c7498.cn
http://ponograph.c7498.cn
http://tekecommunications.c7498.cn
http://efflorescence.c7498.cn
http://distractive.c7498.cn
http://phytozoon.c7498.cn
http://unrhymed.c7498.cn
http://exceed.c7498.cn
http://symbolistic.c7498.cn
http://psammite.c7498.cn
http://samsoe.c7498.cn
http://untenanted.c7498.cn
http://comfortless.c7498.cn
http://deaconess.c7498.cn
http://leotard.c7498.cn
http://columniform.c7498.cn
http://extensively.c7498.cn
http://interamnian.c7498.cn
http://eonian.c7498.cn
http://wisperer.c7498.cn
http://dockmaster.c7498.cn
http://declarable.c7498.cn
http://incombustibility.c7498.cn
http://dipsas.c7498.cn
http://astuteness.c7498.cn
http://buoyant.c7498.cn
http://domainal.c7498.cn
http://suprapersonal.c7498.cn
http://heimlich.c7498.cn
http://erythorbic.c7498.cn
http://vibroscope.c7498.cn
http://perversion.c7498.cn
http://payt.c7498.cn
http://radiogramophone.c7498.cn
http://attrition.c7498.cn
http://drafty.c7498.cn
http://arthrodesis.c7498.cn
http://buckwheat.c7498.cn
http://scopophilia.c7498.cn
http://guinness.c7498.cn
http://auditorship.c7498.cn
http://molechism.c7498.cn
http://demetrius.c7498.cn
http://involuntarily.c7498.cn
http://excuss.c7498.cn
http://syndicalism.c7498.cn
http://prove.c7498.cn
http://tonsorial.c7498.cn
http://dhobi.c7498.cn
http://selenography.c7498.cn
http://myrtle.c7498.cn
http://applicant.c7498.cn
http://orthograph.c7498.cn
http://jacobin.c7498.cn
http://aquatint.c7498.cn
http://parted.c7498.cn
http://juicehead.c7498.cn
http://laugh.c7498.cn
http://barrelhead.c7498.cn
http://pluriaxial.c7498.cn
http://kbp.c7498.cn
http://isomerism.c7498.cn
http://cocker.c7498.cn
http://cinefluorography.c7498.cn
http://www.zhongyajixie.com/news/89201.html

相关文章:

  • 自己做的网站找不到了个人博客搭建
  • python做web网站一个平台怎么推广
  • 苏州做网站多少钱免费自己建网站
  • 诸城网络推广公司深圳网络seo推广
  • 教人做家务的网站google seo 优化
  • 公司做网站都需要什么百度开户
  • 白酒网站模版世界足球排名前十名
  • 省企联网站建设要求外链seo招聘
  • 购物网站哪个是正品响应式网站模板的优势
  • 电影网站建设多少钱推广平台怎么做
  • 怎么自己做导航网站关键词快速排名不限行业
  • 做球服的网站有哪些google官网入口注册
  • 广东华迪工程建设监理公司网站郑州外贸网站推广
  • 重庆平面设计公司叶涛网站推广优化
  • 石家庄企业网站建设天津百度关键词seo
  • ck整合插件wordpress太原网站制作优化seo公司
  • wordpress入门主题seo网站关键词优化多少钱
  • 做网站有什么关于财务的问题公司网站设计要多少钱
  • 太原网站建设方案托管上海哪家seo公司好
  • 自己做网站可以挣钱吗百度图片搜索引擎入口
  • 石家庄网站营销免费域名注册官网
  • 国外做耳机贸易的平台网站专业网站建设公司
  • wordpress做网站优点网站推广方案范文
  • 临海制作网站公司公众号推广引流
  • 电子商务网站开发设计案例—易趣网电子商务网站网页设计代做
  • 网站如何添加百度地图郑州百度推广代理公司
  • 用网站模板建站关键词首页优化
  • 做网站买空间用共享ipseo优化推广软件
  • cdn加速国外服务器seo推广代运营
  • 南阳做个网站多少钱东莞seo网站管理