程序员scholar 程序员scholar
首页
  • Web 三剑客

    • HTML
    • CSS
    • JavaScript
  • 现代 JavaScript

    • ES6
    • TypeScript
  • 前端工具库

    • jQuery
    • Ajax
    • Axios
  • Vue 生态

    • Vue2
    • Vue3
    • Vue3 + TS
    • Vuex
  • 小程序开发

    • 微信小程序
    • uni-app
  • 构建工具

    • Webpack
  • 服务端技术

    • Node.js
  • 实时通信

    • WebSocket
    • 第三方登录
  • Element-UI
  • Apache ECharts
后端 (opens new window)
  • 面试问题常见

    • 十大经典排序算法
    • 面试常见问题集锦
关于
GitHub (opens new window)
首页
  • Web 三剑客

    • HTML
    • CSS
    • JavaScript
  • 现代 JavaScript

    • ES6
    • TypeScript
  • 前端工具库

    • jQuery
    • Ajax
    • Axios
  • Vue 生态

    • Vue2
    • Vue3
    • Vue3 + TS
    • Vuex
  • 小程序开发

    • 微信小程序
    • uni-app
  • 构建工具

    • Webpack
  • 服务端技术

    • Node.js
  • 实时通信

    • WebSocket
    • 第三方登录
  • Element-UI
  • Apache ECharts
后端 (opens new window)
  • 面试问题常见

    • 十大经典排序算法
    • 面试常见问题集锦
关于
GitHub (opens new window)
npm

(进入注册为作者充电)

  • 原生微信小程序

  • uniapp多端开发

    • 快速入门

    • 内置组件

    • 扩展组件

      • uni-ui 介绍
      • Uni-UI 的安装和使用
      • uni-sass 辅助样式
      • uni-badge 数字角标
      • uni-breadcrumb 面包屑
      • uni-calendar 日历
      • uni-card 卡片
      • uni-collapse 折叠面板
      • uni-combox 组合框
      • uni-countdown 倒计时
      • uni-data-checkbox 数据选择器
      • uni-data-picker 级联选择器
      • uni-data-select 下拉框
      • uni-dateformat 日期格式化
      • uni-datetime-picker 日期选择器
      • uni-drawer 抽屉
      • uni-easyinput 增强输入框
      • uni-fab 悬浮按钮
      • uni-fav 收藏按钮
      • uni-file-picker 文件选择上传
      • uni-forms 表单
      • uni-goods-nav 商品导航
      • uni-grid 宫格
      • uni-group 分组
      • uni-icons 图标
      • uni-indexed-list 索引列表
      • uni-link 超链接
      • uni-list 列表
      • uni-load-more 加载更多
      • uni-nav-bar 自定义导航栏
      • uni-notice-bar 通告栏
      • uni-number-box 数字输入框
      • uni-pagination 分页器
      • uni-popup 弹出层
      • uni-rate 评分
      • uni-row 布局-行
      • uni-search-bar 搜索栏
      • uni-section 标题栏
        • 介绍
          • 基本用法
        • 属性/方法
          • Section Props
          • Section Events
        • 示例
      • uni-segmented-control 分段器
      • uni-steps 步骤条
      • uni-swipe-action 滑动操作
      • uni-swiper-dot 轮播图指示点
      • uni-table 表格
      • uni-tag 标签
      • uni-title 章节标题
      • uni-tooltip 文字提示
      • uni-transition 过渡动画
  • 小程序开发
  • uniapp多端开发
  • 扩展组件
scholar
2024-10-21
目录

uni-section 标题栏

组件名:uni-section

代码块: uSection

点击下载&安装 (opens new window)

标题栏组件,主要用于文章、列表详情等标题展示。

# 介绍

# 基本用法

在 template 中使用组件

<uni-section class="mb-10" title="基础用法" sub-title="副标题"></uni-section>

<uni-section class="mb-10" title="竖线装饰" sub-title="副标题" type="line"></uni-section>

<uni-section class="mb-10" title="装饰器插槽" sub-title="副标题">
  <template v-slot:decoration>
    <view class="decoration"></view>
  </template>
</uni-section>

<uni-section class="mb-10" title="默认插槽" sub-title="副标题">默认插槽内容</uni-section>

<uni-section class="mb-10" title="主标题">
  <template v-slot:right>
    right slot
  </template>
</uni-section>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 属性/方法

# Section Props

属性名 类型 默认值 说明
type String - 装饰类型,可选值:line(竖线)、circle(圆形)、square(方形)
title String - 主标题
titleFontSize String 14px 主标题字体大小
titleColor String #333 主标题字体颜色
subTitle String - 副标题
subTitleFontSize String 12px 副标题字体大小
subTitleColor String #999 副标题字体颜色
padding Boolean/String false 默认插槽容器的 padding 值,传入类型为 Boolean 时,设置为 10px 或 0

# Section Events

事件名 事件说明 返回参数
@click 点击 Section 触发事件 -

# 示例

注意

直接拷贝示例代码,无法运行 ,示例依赖了 uni-scss 组件。

请到 组件下载页面 (opens new window) ,在页面右侧选择 使用 HBuilderX导入示例项目 ,体验完整组件示例。

<template>
	<view class="uni-wrap">
			<view class="example-info">
				<text class="example-info-text"> uni-section 组件主要用于文章、列表详情等标题展示 </text>
			</view>
			<uni-section class="mb-10" title="基础用法" sub-title="副标题"></uni-section>
			<uni-section class="mb-10" title="竖线装饰" sub-title="副标题" type="line"></uni-section>
			<uni-section class="mb-10" title="装饰器插槽" sub-title="副标题">
        <template v-slot:decoration>
          <view class="decoration"></view>
        </template>
      </uni-section>
			<uni-section class="mb-10" title="默认插槽" sub-title="副标题" padding="0 0 5px 10px">默认插槽内容</uni-section>
			<uni-section class="mb-10" title="主标题">
				<template v-slot:right>
					right slot
				</template>
			</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			}
		},
		onReady() {

		},
		methods: {

		}
	}
</script>

<style lang="scss">
  $uni-success: #18bc37 !default;

	.uni-wrap {
		flex-direction: column;
		/* #ifdef H5 */
		height: calc(100vh - 44px);
		/* #endif */
		/* #ifndef H5 */
		height: 100vh;
		/* #endif */
		flex: 1;
	}

	.mb-10 {
		margin-bottom: 10px;
	}

  .decoration{
    width: 6px;
    height: 6px;
		margin-right: 4px;
    border-radius: 50%;
		background-color: $uni-success;
  }
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
编辑此页 (opens new window)
uni-search-bar 搜索栏
uni-segmented-control 分段器

← uni-search-bar 搜索栏 uni-segmented-control 分段器→

Theme by Vdoing | Copyright © 2019-2025 程序员scholar
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式