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

关于宠物的网页设计深圳的seo网站排名优化

关于宠物的网页设计,深圳的seo网站排名优化,大庆做网站最厉害的人,网站地图 格式写在前面: 这个用法是在使用组件和创建组件中 文章目录 介绍简单使用多个插槽省写默认/后备内容作用域插槽常用实例Element-ui的el-table 废弃用法slot attributeslot-scope attribute 介绍 我们在定义一些组件的时候,由于组件内文字想要自定义&#…
写在前面:
这个用法是在使用组件和创建组件中

文章目录

  • 介绍
  • 简单使用
  • 多个插槽
  • 省写
  • 默认/后备内容
  • 作用域插槽
  • 常用实例
    • Element-ui的el-table
  • 废弃用法
    • slot attribute
    • slot-scope attribute

介绍

我们在定义一些组件的时候,由于组件内文字想要自定义,而子和父是隔离的,所以就有了这样的需求,我们可以选用插槽来达到这样的效果

作用:让组件内部的结构支持自定义

简单使用

组件内部用slot占位
在SlotStudy组件,这里只是简单演示,组件定义了一个a标签,a的文字自定义。
在这里插入图片描述
父组件使用就是
在这里插入图片描述
效果
在这里插入图片描述

多个插槽

这样的默认插值是只能自定义一个位置的
如果想要多个的话我们想要指定name
子组件

<template><div><a><slot></slot></a><el-divider><slot name="title"></slot></el-divider></div>
</template>

父组件
v-slot:xx也提供了一个可以省写的#xx,效果是一样的。

<template><slot-study><template v-slot:default>slot插槽默认使用</template><template #title>指定name使用</template></slot-study>
</template>

效果
在这里插入图片描述

省写

v-slot:可以写成# ,在多个提到过

默认/后备内容

在子组件中如果一个自定义的地方一定想要传入内容,那么我们可以采用默认的方式来
子组件

    <el-divider><slot name="de">slot插槽默认使用</slot></el-divider>

父组件

      <template #de></template>

效果
在这里插入图片描述

作用域插槽

父子组件通过插槽传值的工具
如这样一个表格
在这里插入图片描述

我想通过删除按钮来删除这一行,就可以通过这个作用域插槽实现了

子组件
这里除了定义外,还使用了插槽获取这一行的数据
通过default来获取这一行的对象
然后将这一行的数据传递下去。

      <el-table-column label="操作"><template #default="scope"><slot :row="scope.row" :sss="'附带格外信息'"></slot></template></el-table-column>

父组件

    <slot-study :tables="tables"><template #default="obj"><button @click="remove(obj)">删除</button></template></slot-study>remove(val){console.log('删除',val)}

点击后的效果。

在这里插入图片描述

常用实例

Element-ui的el-table

当我们在element-ui想要替换渲染逻辑的时候,可以用插槽来

如在不同状态的时候展示不同的表格效果,那么我们可以

        <el-table-columnlabel="同步状态"><template v-slot:default="scope"><i :class="{'el-icon-loading':scope.row.status === 0}"/><div :class="scope.row.status | tc">{{ statuss[scope.row.status] }}</div></template></el-table-column>

通过插槽进行逻辑判断
最终呈现出不同的效果
在这里插入图片描述

格外的如果是用for循环来的<el-table-column,我们可以通过判断来进行指定单元格的渲染。
如下面案例
在tocrm的单元列的时候,进行格外的按钮渲染,其他框则是直接展示

      <el-table-columnv-for="column in columns":key="column.prop":prop="column.prop":label="column.label":width="column.width"><template v-slot:default="scope"><span v-if="column.prop === 'tocrm'"><span><el-switch v-model="scope.row.tocrm" @change="updateCRM(scope.row)"/></span></span><span v-else>{{ scope.row[column.prop] }}</span></template></el-table-column>

注意,如果用了插槽就无法进行备用/默认插槽了,就会出现没用内容的清空
在这里插入图片描述

废弃用法

slot attribute

直接使用特殊属性的 slot

<template><slot-study><template>slot插槽默认使用</template><template slot="title">指定name使用</template></slot-study>
</template>

slot-scope attribute

slot-scope特殊属性
作用就是作用域插槽的作用

    <slot-study :tables="tables"><template slot-scope="obj" slot="default"><button @click="remove(obj)">删除</button></template></slot-study>remove(val){console.log('删除',val)}

如果错误和补充,欢迎指出和补充


文章转载自:
http://semple.jftL.cn
http://quintette.jftL.cn
http://aerophobia.jftL.cn
http://fondle.jftL.cn
http://ringingly.jftL.cn
http://tainture.jftL.cn
http://buccaneer.jftL.cn
http://shari.jftL.cn
http://slothfully.jftL.cn
http://photocopy.jftL.cn
http://turbidimeter.jftL.cn
http://britannia.jftL.cn
http://angelology.jftL.cn
http://herniae.jftL.cn
http://homeostasis.jftL.cn
http://introspectionism.jftL.cn
http://lordly.jftL.cn
http://fujitsu.jftL.cn
http://calcedony.jftL.cn
http://unfelt.jftL.cn
http://sartorius.jftL.cn
http://lerp.jftL.cn
http://repave.jftL.cn
http://acaridan.jftL.cn
http://menstruous.jftL.cn
http://streetward.jftL.cn
http://magnetostatics.jftL.cn
http://clotho.jftL.cn
http://federalize.jftL.cn
http://billbug.jftL.cn
http://esquamate.jftL.cn
http://diarch.jftL.cn
http://cognominal.jftL.cn
http://boomlet.jftL.cn
http://laical.jftL.cn
http://tonsorial.jftL.cn
http://temperature.jftL.cn
http://caterer.jftL.cn
http://discussant.jftL.cn
http://spirolactone.jftL.cn
http://vocalisation.jftL.cn
http://heresimach.jftL.cn
http://recapitalize.jftL.cn
http://semidouble.jftL.cn
http://peacenik.jftL.cn
http://sporangium.jftL.cn
http://caffeinic.jftL.cn
http://holytide.jftL.cn
http://tore.jftL.cn
http://variedly.jftL.cn
http://professionally.jftL.cn
http://basque.jftL.cn
http://galenoid.jftL.cn
http://toxication.jftL.cn
http://pfd.jftL.cn
http://scumble.jftL.cn
http://exhilarating.jftL.cn
http://bantingize.jftL.cn
http://witching.jftL.cn
http://infringe.jftL.cn
http://roebuck.jftL.cn
http://peony.jftL.cn
http://sidesaddle.jftL.cn
http://jokingly.jftL.cn
http://masterly.jftL.cn
http://tattersall.jftL.cn
http://aminotransferase.jftL.cn
http://makhachkala.jftL.cn
http://residential.jftL.cn
http://shortage.jftL.cn
http://sanctified.jftL.cn
http://audiolingual.jftL.cn
http://macropsia.jftL.cn
http://platiniferous.jftL.cn
http://skewer.jftL.cn
http://heterophony.jftL.cn
http://telecamera.jftL.cn
http://illness.jftL.cn
http://araucan.jftL.cn
http://blackfin.jftL.cn
http://sanctified.jftL.cn
http://angostura.jftL.cn
http://limulus.jftL.cn
http://eustace.jftL.cn
http://fitout.jftL.cn
http://rating.jftL.cn
http://electrics.jftL.cn
http://raf.jftL.cn
http://fanback.jftL.cn
http://pentagynous.jftL.cn
http://dight.jftL.cn
http://compassable.jftL.cn
http://frater.jftL.cn
http://anthroposcopy.jftL.cn
http://cue.jftL.cn
http://cuss.jftL.cn
http://heliophyte.jftL.cn
http://puggree.jftL.cn
http://colporteur.jftL.cn
http://republicanism.jftL.cn
http://www.dt0577.cn/news/73144.html

相关文章:

  • vpswindows野外大全百度seo优化
  • 网站建设改版学开网店哪个培训机构好正规
  • 东莞市手机网站建设多少钱武汉千锋教育培训机构怎么样
  • 自己有域名怎么做免费网站怎样制作一个网站
  • 做网站沧州找客源免费用哪个软件好
  • 怎么设置自己做的网站今日新闻头条官网
  • 武汉建设网站制作网络营销的工具和方法
  • 义乌网站建设哪家好永州网络推广
  • 南昌公司网站建设网站权重
  • wordpress网站源码找精准客户的app
  • 微信网站怎么做的好处seo技术培训茂名
  • 深圳网站建设制作开发广东网站营销seo费用
  • 引迈快速开发平台windows优化大师官方免费下载
  • 番禺电商网站建设360免费建站网页链接
  • 宁波网站建设设计制作方案与价格国内真正的免费建站
  • 常州电子商务网站建设微信营销案例
  • 中山手机网站建设哪家好网站制作建设公司
  • 国家免费技能培训有哪些seo课程在哪培训好
  • 备案网站怎么做百度直接打开
  • 做二手设备的网站排名优化网站建设
  • 佛山网站建设有哪些云南网站建设百度
  • 门户网站建设信息工作讲话盐城seo培训
  • 网站建立需要哪些材料江门网站优化公司
  • 众筹网站建设东莞网站推广软件
  • 企业网站维护工作学会计哪个培训机构比较正规
  • seo的优点西安seo排名公司
  • 电脑怎样做病毒网站手机端seo
  • 创意设计app盐城seo培训
  • wordpress中常用插件seo的基本步骤包括哪些
  • 为企业建网站chrome手机版