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

虚拟机wordpress建站江西省建设工程有限公司

虚拟机wordpress建站,江西省建设工程有限公司,wordpress link rel,做网站销售有前景吗作用&#xff1a;让父组件可以向子组件指定位置插入HTML结构&#xff0c;也是一种组件间通信的方式&#xff0c;适用于父组件>子组件。一、默认插槽使用方式&#xff1a;父组件&#xff1a;<xxxx><div>html结构</div></xxxx>子组件&#xff1a;<…

        作用:让父组件可以向子组件指定位置插入HTML结构,也是一种组件间通信的方式,适用于父组件==>子组件

一、默认插槽

        使用方式:

                父组件:

                <xxxx>

                        <div>html结构</div>

                </xxxx>

                子组件:

                <template>

                        <div>

                                <slot>插槽默认内容........</slot>

                        </div>

                </template>

/*    App.vue    */
<template><div class="container"><Category title="foods"><img src="https://s3.ax1x.com/2021/01/16/srJlq0.jpg" alt=""></Category><Category title="games"><ul><li v-for="(item,index) in games" :key="index">{{ item }}</li></ul></Category><Category title="films"><video controls src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video></Category></div>
</template><script>import Category from './Components/Category'export default {name:'App',components:{Category},data() {return {foods:['火锅','烧烤','小龙虾','牛排'],games:['红色警戒','穿越火线','劲舞团','超级玛丽'],films:['《教父》','《拆弹专家》','《你好,李焕英》','《尚硅谷》']}},}
</script><style>.container{display: flex;justify-content: space-around;}img,video{width: 100%;}
</style>
/*    Category.vue    */
<template><div><h2>{{ title }}</h2><slot></slot></div>
</template><script>export default {name:'Category',props:['title','listData']}
</script><style lang="less" scoped>div{width: 200px;height: 300px;background-color: skyblue;}h2{text-align: center;background-color: orange;}
</style>

二、具名插槽

        使用方式:

                父组件:                       

                <xxxx>

                        <template slot="center">

                                <div>html结构1</div>

                        </template>

                         <template slot="footer">

                                <div>html结构2</div>

                         </template>

                </xxxx>

                 子组件:

                <template>

                        <div>

                                <slot name="center">插槽默认内容........</slot>

                                <slot name="footer">插槽默认内容........</slot>

                        </div>

                </template>

/*    App.vue    */
<template><div class="container"><Category title="foods"><img slot="center" src="https://s3.ax1x.com/2021/01/16/srJlq0.jpg" alt=""><a class="foot" slot="footer" href="http://www.baidu.com">更多美食</a></Category><Category title="games"><ul slot="center"><li v-for="(item,index) in games" :key="index">{{ item }}</li></ul><div slot="footer" class="foot"><a href="http://www.baidu.com">单机游戏</a><a href="http://www.baidu.com">网络游戏</a></div></Category><Category title="films"><video slot="center" controls src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video><template v-slot:footer><div class="foot"><a href="http://www.baidu.com">经典</a><a href="http://www.baidu.com">热门</a><a href="http://www.baidu.com">推荐</a></div><h4>欢迎前来观影</h4></template></Category></div>
</template><script>import Category from './Components/Category'export default {name:'App',components:{Category},data() {return {foods:['火锅','烧烤','小龙虾','牛排'],games:['红色警戒','穿越火线','劲舞团','超级玛丽'],films:['《教父》','《拆弹专家》','《你好,李焕英》','《尚硅谷》']}},}
</script><style>.container,.foot{display: flex;justify-content: space-around;}img,video{width: 100%;}h4{text-align: center;}a{padding-top: 10px;}
</style>
/*    Category.vue    */
<template><div class="main"><h2>{{ title }}</h2><slot name="center"></slot><slot name="footer"></slot></div>
</template><script>export default {name:'Category',props:['title','listData']}
</script><style lang="less" scoped>.main{width: 200px;height: 300px;background-color: skyblue;}h2{text-align: center;background-color: orange;}
</style>

三、作用域插槽

        1.理解:数据在组件的自身,但根据数据生成的结构需要组建的使用者来决定。

        2.使用方法:        

                父组件:

                <xxxx>
<template scope="scopeData">
<ul>
<li v-for="g in scopeData.games" :key="g">{{g}}</li>
</ul>
</template>
</xxxx>

                <xxxx>
<template slot-scope="scopeData">
<h4 v-for="g in scopeData.games" :key="g">{{g}}</h4>
</template>
</xxxx>

                 子组件:

                <template>
<div>
<slot :games="games"></slot>
</div>
</template>
<script>
export default {
name:'Category',
props:['title'],
data() {
return {
games:['红色警戒','穿越火线','劲舞团','超级玛丽']
}
},
}
</script>

               

/*    App.vue    */
<template><div class="container"><Category title="games"><template slot-scope="{games}"><ul><li v-for="(item,index) in games" :key="index">{{ item }}</li></ul></template></Category><Category title="games"><template slot-scope="{games}"><ol><li v-for="(item,index) in games" :key="index">{{ item }}</li></ol></template></Category><Category title="games"><template slot-scope="{games}"><h4 v-for="(item,index) in games" :key="index">{{ item }}</h4></template></Category></div>
</template><script>import Category from './Components/Category'export default {name:'App',components:{Category},}
</script><style>.container,.foot{display: flex;justify-content: space-around;}img,video{width: 100%;}h4{text-align: center;}a{padding-top: 10px;}
</style>
/*    Category.vue    */
<template><div class="main"><h2>{{ title }}</h2><slot :games="games"></slot></div>
</template><script>export default {name:'Category',data() {return {games:['红色警戒','穿越火线','劲舞团','超级玛丽'],}},props:['title','listData']}
</script><style lang="less" scoped>.main{width: 200px;height: 300px;background-color: skyblue;}h2{text-align: center;background-color: orange;}
</style>
http://www.dtcms.com/a/586570.html

相关文章:

  • 如何免费注册自己的网站织梦网站怎么做优化
  • 软考高级考试过程
  • 优质的低价网站建设网站类型大全
  • 深圳设计网站培训学校网站接入地查询
  • 蓝牙应用层dbus接口
  • 基于SpringBoot的健身房管理系统【智能推荐算法+可视化统计】
  • 智能体颠覆教育行业:现状、应用与未来展望调研报告
  • 中国建筑设计作品网站阜阳网站建设专业机构
  • 海南七星彩网站开发算命网站做竞价赚钱
  • C4D缝纫和翻褶工具详解:布料模拟的关键技巧
  • 数据链路层概述
  • 下载网站建设网站源码下载pdf文件
  • 做报废厂房网站怎么做邵阳做网站哪个公司好
  • 成都知名网络营销公司seo网站管理
  • icp是网站备案个人网站建设概述
  • Android Hilt 入门教程_实战
  • 兰州网站设计公司哪家最好网站建设客源开发
  • 无锡好的网站公司WordPress登录不进
  • C++ 枚举(enum)与联合体(union)全解析——从内存到底层机制全面掌握
  • 做网站国外网站网站搬迁
  • SAMSUNG三星MICRON美光SEAGATE希捷WD西数数据处理中心企业级SSD硬盘
  • 个人网站 前置审批福建省建设相关网站
  • 桶排序相关知识深入理解(计数排序,基数排序)
  • 医院门户网站建设规划时尚flash网站
  • 怎么做网站免费的刷赞漳州台商投资区建设局网站
  • 100m网站注册织梦 网站公告
  • 网站备案年限查询电子邮箱注册网站申请
  • 张家港网站推广优化wordpress能做交互类网站
  • 北京建站的中国建设部网站能查叉车证
  • php外贸网站制作淄博网站制作公司推广