# 吸顶容器 sticky

# 描述

用于在滚动页面时将标题栏固定在顶部

# 使用效果

# 使用方法

.ux文件中引入组件

<import name="my-sticky" src="apex-ui/components/sticky/index.ux"></import>
<import name="my-sticky-item" src="apex-ui/components/sticky-item/index.ux"></import>
1
2

# 示例

<template>
  <div>
    <my-sticky id="sticky1">
      <my-sticky-item group-id="sticky1" title="🐶🐶🐶🐶">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🐱🐱🐱🐱">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🐭🐭🐭🐭">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🐹🐹🐹🐹">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🐸🐸🐸🐸">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🥺🥺🥺🥺">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🤩🤩🤩🤩">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🤯🤯🤯🤯">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
      <my-sticky-item group-id="sticky1" title="🤔🤔🤔🤔">
        <div class="my-content" slot="content">
          <div class="demo-item"><text>呦呦呦呦呦呦呦呦呦呦呦呦</text></div>
          <div class="demo-item"><text>啦啦啦啦啦啦啦啦啦啦</text></div>
          <div class="demo-item"><text>哔卟哔卟哔卟哔卟哔卟哔卟哔卟</text></div>
          <div class="demo-item"><text>略略略略略略略略略略略略略略略略</text></div>
          <div class="demo-item"><text>嘎嘎嘎嘎嘎嘎嘎嘎嘎嘎</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>吱吱喳喳吱吱喳喳</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
          <div class="demo-item"><text>哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦哗啦啦</text></div>
          <div class="demo-item"><text>红红火火恍恍惚惚红红火火恍恍惚惚</text></div>
        </div>
      </my-sticky-item>
    </my-sticky>
  </div>
</template>
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<style>
.my-content {
  flex-direction: column;
  background-color: #fff;
  width: 100%;
}

.demo-item {
  border-bottom: 1px solid #ddd;
  padding: 20px;
}

text {
  color: #000;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# API

# sticky组件属性

属性 类型 默认值 说明
id String '' sticky组件ID,必填

# sticky-item组件属性

属性 类型 默认值 说明
title String '' 标题
content String '' 内容
groupId String '' 所属的sticky组件的ID,必填

# sticky-item slot

名称 描述
content 自定义标题