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

13.Home-面板组件封装

场景说明

组件封装

1.静态模板

<script setup></script><template><div class="home-panel"><div class="container"><div class="head"><!-- 主标题和副标题 --><h3>新鲜好物<small>新鲜出炉 品质靠谱</small></h3></div><!-- 主体内容区域 --><div> 主体内容 </div></div></div>
</template><style scoped lang='scss'>
.home-panel {background-color: #fff;.head {padding: 40px 0;display: flex;align-items: flex-end;h3 {flex: 1;font-size: 32px;font-weight: normal;margin-left: 6px;height: 35px;line-height: 35px;small {font-size: 16px;color: #999;margin-left: 20px;}}}
}
</style>

2.完整代码

<script setup>defineProps({title: {type: String,default: ''},subTitle: {type: String,default: ''}
})</script><template><div class="home-panel"><div class="container"><div class="head"><!-- 主标题和副标题 --><h3>{{ title }}<small>{{ subTitle }}</small></h3></div><!-- 主体内容区域 --><slot name="main" /></div></div>
</template><style scoped lang='scss'>
.home-panel {background-color: #fff;.head {padding: 40px 0;display: flex;align-items: flex-end;h3 {flex: 1;font-size: 32px;font-weight: normal;margin-left: 6px;height: 35px;line-height: 35px;small {font-size: 16px;color: #999;margin-left: 20px;}}}
}
</style>

3.测试一下

4.问题

父组件是谁

http://www.lryc.cn/news/609963.html

相关文章:

  • Mac桌面仿制项目--让ai一句话生成的
  • mac 技巧
  • 【AI 加持下的 Python 编程实战 2_13】第九章:繁琐任务的自动化(中)——自动批量合并 PDF 文档
  • 大模型×垂直领域:预算、时间、空间三重夹击下的生存法则
  • 2.2 vue2子组件注册使用
  • 西门子PLC S7-1200单轴步进控制电动机
  • Axure设计Web端新增表单页面模板案例
  • 【LeetCode 热题 100】215. 数组中的第K个最大元素——(解法一)快速选择
  • 安卓逆向(基础①-Google Pixel-Root)
  • Visual Studio 2022安装与快捷键全攻略
  • 模型蒸馏(Distillation):原理、算法、应用
  • 【达梦MPP(带主备)集群搭建】
  • Selenium教程(Python 网页自动化测试脚本)
  • 华为2288H V5服务器闪红灯 无法开机案例
  • C++八股文——设计模式
  • JSON Schema
  • mybatis-plus报错Caused by: java.sql.SQLException: 无效的列类型: 1111
  • 使用 Aspose.OCR 将图像文本转换为可编辑文本
  • 微软WSUS替代方案
  • Druid手写核心实现案例 实现一个简单Select 解析,包含Lexer、Parser、AstNode
  • AJAX表单验证项目实战:实时用户名检查
  • curl发送文件bodyParser无法获取请求体的问题分析
  • Stanford CS336 assignment1 | Byte-Pair Encoding (BPE) Tokenizer
  • NeoBase:一款开源、基于AI的数据库管理助手
  • 《Python 实用项目与工具制作指南》· 2.2 变量
  • Java中给List<T> 对象集合去重
  • golang的数组
  • SpringMVC 6+源码分析(三)DispatcherServlet实例化流程 2--(url 与contrller类如何进行映射)
  • 【Spring AI快速上手 (一)】ChatModel与ChatCilent构建对话
  • 小鹏汽车前端面经