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

网站建设国家和行业标准用php开发网站教程

网站建设国家和行业标准,用php开发网站教程,长沙网站维护公司,企业信息查询系统官网北京第IV章-Ⅱ Vue3中的插槽使用 基本插槽默认内容 具名插槽作用域插槽 在 Vue 3 中#xff0c;插槽#xff08;slots#xff09;是一种强大的模式#xff0c;用于将模板代码从父组件注入到子组件中#xff0c;使得子组件的内容可以在使用时被自定义。Vue 3 中的插槽用法包括基… 第IV章-Ⅱ Vue3中的插槽使用 基本插槽默认内容 具名插槽作用域插槽 在 Vue 3 中插槽slots是一种强大的模式用于将模板代码从父组件注入到子组件中使得子组件的内容可以在使用时被自定义。Vue 3 中的插槽用法包括基本插槽、具名插槽和作用域插槽。 基本插槽 基本插槽允许父组件向子组件传递内容这些内容在子组件的模板中通过一个简单的 标签进行定义和显示。 子组件 templatedivslot/slot !-- 默认插槽 --/div /templatescript langts import { defineComponent } from vue;export default defineComponent({name: ChildComponent }); /script父组件 templatedivChildComponentpThis content will go into the default slot of the ChildComponent./p/ChildComponent/div /templatescript langts import { defineComponent } from vue; import ChildComponent from ./ChildComponent.vue;export default defineComponent({name: ParentComponent,components: {ChildComponent} }); /script 默认内容 可以在 标签内部指定默认内容如果父组件没有提供任何插槽内容将显示默认内容。 子组件 templatedivslotDefault content if nothing is provided by the parent./slot/div /template 具名插槽 具名插槽允许你为不同的插槽内容定义多个插槽每个插槽都有其唯一的名字。这样父组件可以针对特定的插槽提供内容。 子组件 templatedivslot nameheader/slotslot namemain/slotslot namefooter/slot/div /templatescript langts import { defineComponent } from vue;export default defineComponent({name: ChildComponent }); /script父组件 templateChildComponenttemplate v-slot:headerh1Header Content/h1/templatetemplate v-slot:mainpMain Content of the Page/p/templatetemplate v-slot:footerfooterFooter Details/footer/template/ChildComponent /templatescript langts import { defineComponent } from vue; import ChildComponent from ./ChildComponent.vue;export default defineComponent({name: ParentComponent,components: {ChildComponent} }); /script 作用域插槽 作用域插槽Scoped Slots是 Vue 中一种高级的插槽用法允许子组件将其内部的数据传递回给使用这些插槽的父组件的插槽内容。这种方式不仅可以让父组件插入 HTML 或组件还能让父组件访问子组件中定义的数据非常适合创建高度可定制和复用的组件。 子组件 templateul!-- 使用作用域插槽将 todo 对象作为插槽的数据传递给父组件 --li v-fortodo in todos :keytodo.idslot nametodo :todo-datatodo!-- 默认内容如果父组件没有提供插槽模板 --{{ todo.text }}/slot/li/ul /templatescript langts import { defineComponent, PropType } from vue;export default defineComponent({name: TodoList,props: {todos: Array as PropTypeArray{ id: number; text: string }} }); /script父组件 templateTodoList :todostodoItems!-- 定义如何使用 todo 数据渲染每个待办事项 --template v-slot:todo{ todo }strong{{ todo.text }}/strong (ID: {{ todo.id }})/template/TodoList /templatescript langts import { defineComponent, ref } from vue; import TodoList from ./components/TodoList.vue;export default defineComponent({name: App,components: {TodoList},setup() {const todoItems ref([{ id: 1, text: Finish the report },{ id: 2, text: Meet with the client },{ id: 3, text: Prepare presentation }]);return { todoItems };} }); /script 子组件提供了一个todo插槽每一个todo的数据通过todo-data传递给插槽。父组件接收这个数据并自定义了如何显示每个项目。 提示v-slot:todo 简写 #todotodo
http://www.w-s-a.com/news/706080/

相关文章:

  • 医院网站建设实施方案基础微网站开发信息
  • 网站建设开发服务费记账百度指数搜索
  • 网站建设备案流程windows优化大师有必要安装吗
  • 怎么网站定制自己做网站卖视频
  • 网站开发二线城市网站制作过程中碰到的问题
  • 最好网站建设公司制作平台小程序开发教程资料
  • 陕西省高速建设集团公司网站国内做会展比较好的公司
  • 建设学校网站的原因网页设计实训报告1500
  • 网站建设客户来源江门网站设计华企立方
  • 自己如何做棋牌网站宁波网络推广优化方案
  • 深圳招聘网站推荐seo网站推广方案
  • 彩票网站开发 合法学术会议网站建设
  • 商务网站建设论文答辩pptseo技术博客
  • 怎样才能有自己的网站桂林搭建公司
  • 哪个网站做视频赚钱万科
  • 莆系医疗网站建设wp如何做网站地图
  • 网站建设应急处置方案团购网站 备案问题
  • 网站建设 岗位职责浙江中天建设集团有限公司网站
  • 西海岸建设局网站用wordpress建站学什么
  • 网站静态和动态学校网站建设流程步骤
  • 做群头像的网站在线怎么做俄语网站
  • 西安网站定制开发国内cms推荐
  • windows网站建设教程视频教程wordpress默认用户头像
  • 做网站需要什么软件wordpress会员邮件通知
  • 技术支持网站合肥网站搭建
  • 无为网站设计免费制作企业网站平台
  • 社交网站第一步怎么做房屋装修效果图用什么软件
  • 企业网站 批量备案合肥 网站建设
  • 如何提高网站索引量室内设计师之路网站
  • ps怎么做响应式网站布局图现在做网站都是怎么做的