xt-element-ui 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/README.md +2 -1
- package/docs/components/base/xt-badge.md +2 -2
- package/docs/components/base/xt-scroll-arrow.md +155 -0
- package/lib/index.common.js +222 -29
- package/lib/index.css +1 -1
- package/lib/index.umd.js +222 -29
- package/lib/index.umd.min.js +4 -4
- package/package.json +3 -2
- package/src/components/index.scss +4 -1
- package/src/components/xt-scroll-arrow/index.js +8 -0
- package/src/components/xt-scroll-arrow/index.vue +190 -0
- package/src/components/xt-scroll-arrow/style/index.scss +89 -0
- package/src/index.js +5 -2
package/docs/README.md
CHANGED
|
@@ -7,7 +7,7 @@ actionText: 🚀 快速上手
|
|
|
7
7
|
actionLink: /components/base/xt-button
|
|
8
8
|
features:
|
|
9
9
|
- title: 🎯 丰富的组件
|
|
10
|
-
details: 提供
|
|
10
|
+
details: 提供 20+ 组件,覆盖布局、表单、数据展示、图表等常见场景
|
|
11
11
|
- title: 📦 开箱即用
|
|
12
12
|
details: 基于 ElementUI 构建,与现有 ElementUI 项目无缝集成
|
|
13
13
|
- title: 🪶 按需引入
|
|
@@ -70,6 +70,7 @@ Vue.use(XtElementUI)
|
|
|
70
70
|
| **XtProgress** | 进度条组件 |
|
|
71
71
|
| **XtTabs** | 标签页组件 |
|
|
72
72
|
| **XtBadge** | 徽标组件 |
|
|
73
|
+
| **XtScrollArrow** | 滚动箭头组件 |
|
|
73
74
|
|
|
74
75
|
### 📊 图表组件
|
|
75
76
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<XtBadge :value="5" type="warning">
|
|
43
43
|
<XtButton size="small">通知</XtButton>
|
|
44
44
|
</XtBadge>
|
|
45
|
-
<XtBadge
|
|
45
|
+
<XtBadge value="99+" type="danger">
|
|
46
46
|
<XtButton size="small">消息</XtButton>
|
|
47
47
|
</XtBadge>
|
|
48
48
|
</div>
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
<template>
|
|
127
127
|
<div style="display: flex; gap: 16px;">
|
|
128
128
|
<XtBadge :value="12" />
|
|
129
|
-
<XtBadge
|
|
129
|
+
<XtBadge value="99+" type="danger" />
|
|
130
130
|
<XtBadge is-dot type="success" />
|
|
131
131
|
</div>
|
|
132
132
|
</template>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
## XtScrollArrow 滚动箭头组件
|
|
2
|
+
|
|
3
|
+
滚动箭头组件用于在内容溢出时显示滚动箭头,支持水平和垂直方向的滚动。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
::: demo 水平滚动
|
|
8
|
+
```vue
|
|
9
|
+
<template>
|
|
10
|
+
<XtScrollArrow :width="300">
|
|
11
|
+
<div style="display: flex; gap: 16px; padding: 8px;">
|
|
12
|
+
<div v-for="i in 10" :key="i" style="width: 80px; height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
|
|
13
|
+
项目 {{ i }}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</XtScrollArrow>
|
|
17
|
+
</template>
|
|
18
|
+
```
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
## 属性说明
|
|
22
|
+
| 属性 | 类型 | 默认值 | 可选值 | 说明 |
|
|
23
|
+
|------|------|--------|--------|------|
|
|
24
|
+
| `direction` | String | horizontal | `horizontal`、`vertical` | 滚动方向 |
|
|
25
|
+
| `scrollStep` | Number | 100 | - | 每次滚动的步长(像素) |
|
|
26
|
+
| `autoHide` | Boolean | true | - | 是否自动隐藏箭头(滚动到边界时隐藏) |
|
|
27
|
+
| `height` | String / Number | - | - | 容器高度 |
|
|
28
|
+
| `width` | String / Number | - | - | 容器宽度 |
|
|
29
|
+
|
|
30
|
+
## 事件说明
|
|
31
|
+
| 事件名称 | 说明 | 参数 |
|
|
32
|
+
|----------|------|------|
|
|
33
|
+
| `scroll` | 滚动时触发 | `scrollContainer` - 滚动容器元素 |
|
|
34
|
+
|
|
35
|
+
## 示例
|
|
36
|
+
|
|
37
|
+
### 垂直滚动
|
|
38
|
+
|
|
39
|
+
::: demo 垂直滚动
|
|
40
|
+
```vue
|
|
41
|
+
<template>
|
|
42
|
+
<XtScrollArrow direction="vertical" :height="200" :width="200">
|
|
43
|
+
<div style="display: flex; flex-direction: column; gap: 12px; padding: 8px;">
|
|
44
|
+
<div v-for="i in 10" :key="i" style="height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
|
|
45
|
+
项目 {{ i }}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</XtScrollArrow>
|
|
49
|
+
</template>
|
|
50
|
+
```
|
|
51
|
+
:::
|
|
52
|
+
|
|
53
|
+
### 自定义滚动步长
|
|
54
|
+
|
|
55
|
+
::: demo 自定义滚动步长
|
|
56
|
+
```vue
|
|
57
|
+
<template>
|
|
58
|
+
<XtScrollArrow :width="300" :scrollStep="50">
|
|
59
|
+
<div style="display: flex; gap: 16px; padding: 8px;">
|
|
60
|
+
<div v-for="i in 10" :key="i" style="width: 80px; height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
|
|
61
|
+
项目 {{ i }}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</XtScrollArrow>
|
|
65
|
+
</template>
|
|
66
|
+
```
|
|
67
|
+
:::
|
|
68
|
+
|
|
69
|
+
### 始终显示箭头
|
|
70
|
+
|
|
71
|
+
::: demo 始终显示箭头
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<XtScrollArrow :width="300" :autoHide="false">
|
|
75
|
+
<div style="display: flex; gap: 16px; padding: 8px;">
|
|
76
|
+
<div v-for="i in 10" :key="i" style="width: 80px; height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
|
|
77
|
+
项目 {{ i }}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</XtScrollArrow>
|
|
81
|
+
</template>
|
|
82
|
+
```
|
|
83
|
+
:::
|
|
84
|
+
|
|
85
|
+
### 结合其他组件使用
|
|
86
|
+
|
|
87
|
+
::: demo 结合按钮组使用
|
|
88
|
+
```vue
|
|
89
|
+
<template>
|
|
90
|
+
<XtScrollArrow :width="400">
|
|
91
|
+
<div style="display: flex; gap: 8px; padding: 8px;">
|
|
92
|
+
<el-button v-for="i in 8" :key="i" type="primary" plain>按钮 {{ i }}</el-button>
|
|
93
|
+
</div>
|
|
94
|
+
</XtScrollArrow>
|
|
95
|
+
</template>
|
|
96
|
+
```
|
|
97
|
+
:::
|
|
98
|
+
|
|
99
|
+
### 动态内容
|
|
100
|
+
|
|
101
|
+
::: demo 动态内容
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<div>
|
|
105
|
+
<el-button @click="addItem" style="margin-bottom: 12px;">添加项目</el-button>
|
|
106
|
+
<XtScrollArrow :width="300">
|
|
107
|
+
<div style="display: flex; gap: 12px; padding: 8px;">
|
|
108
|
+
<div v-for="item in items" :key="item.id" style="width: 80px; height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center;">
|
|
109
|
+
{{ item.name }}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</XtScrollArrow>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<script>
|
|
117
|
+
export default {
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
items: [
|
|
121
|
+
{ id: 1, name: '项目 1' },
|
|
122
|
+
{ id: 2, name: '项目 2' },
|
|
123
|
+
{ id: 3, name: '项目 3' },
|
|
124
|
+
{ id: 4, name: '项目 4' },
|
|
125
|
+
{ id: 5, name: '项目 5' }
|
|
126
|
+
],
|
|
127
|
+
count: 5
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
methods: {
|
|
131
|
+
addItem() {
|
|
132
|
+
this.count++
|
|
133
|
+
this.items.push({ id: this.count, name: `项目 ${this.count}` })
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
```
|
|
139
|
+
:::
|
|
140
|
+
|
|
141
|
+
### 响应式宽度
|
|
142
|
+
|
|
143
|
+
::: demo 响应式宽度
|
|
144
|
+
```vue
|
|
145
|
+
<template>
|
|
146
|
+
<XtScrollArrow width="100%">
|
|
147
|
+
<div style="display: flex; gap: 16px; padding: 8px;">
|
|
148
|
+
<div v-for="i in 10" :key="i" style="width: 100px; height: 60px; background: #f5f7fa; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
|
|
149
|
+
项目 {{ i }}
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</XtScrollArrow>
|
|
153
|
+
</template>
|
|
154
|
+
```
|
|
155
|
+
:::
|